programing

MariaDB / TokuDB의 "Too many keys specified; max 64 keys allowed" 오류에 대한 해결 방법?

anycallme 2023. 11. 2. 22:03

MariaDB / TokuDB의 "Too many keys specified; max 64 keys allowed" 오류에 대한 해결 방법?

테이블에 64개 이상의 인덱스를 만들어야 하는데 "지정된 키가 너무 많습니다. 최대 64개의 키가 허용됩니다." 오류가 발생합니다.MariaDb/TokuDB의 경우 이 제한을 1000 이상으로 늘릴 수 있는 해결책이 있습니까? 아니면 이 제한이 필요한 이유가 있습니까?

(나는 이 질문이 MySQL에 대해 질문/답변하는 것을 보았습니다. -max-indexes=256을 ./configure로 전달하거나 컴파일 시 헤더 파일 중 하나에서 MAX_KEY를 수정하는 것입니다.안타깝게도, 이러한 답변은 MariaDB)에게 적용되지 않는 것 같습니다.

추신. 일반적인 답변은 "이렇게 많은 인덱스가 필요한 경우 잘못된 작업을 수행하고 있습니다."이므로, 제가 이 작업을 수행하고 싶은 이유를 설명해 드리며, 그것이 최선의 "해결 방법"이라면 디자인 수정에 대한 조언을 주시면 감사하겠습니다.

내 데이터는 두 개의 테이블에 저장됩니다.

Table1에는 5개의 열이 저장되어 있습니다. (uniquex_position int, column1 문자열, column2 float, column3 int, column4 tiny int) - 1억 행 정도로 클 수 있습니다.

2는 개념적으로 4개의 열로 나타낼 수 있습니다: (외계 x_position int, sample_id 문자열, value1 tinyint, value2 float) - 고유한 sample_id 값은 최대 5000개까지 존재할 수 있고, 각 (x_position, sample_id) 쌍마다 다른 값 1이 존재하므로 행의 최대 개수는 1억 개 x 5000개 = 5000억 개입니다.

제가 해야 할 쿼리는 다음과 같습니다.

select  column1, column2, column3... sample_id,
        group_concat(value1)
    from  table1, table2
    where  column1 = string1
      and  column2 < float2
      and  ( (sample_id = string1  and  value1=1)
         or  (sample_id = string2  and  value1=0)
         or  (sample_id = string3  and  value1=1)
           )
      and  value2 < float1
    group by  sample_id;

대신, 저는 다음과 같은 열이 되도록 table2를 피벗하는 것이 더 효율적이라고 생각했습니다: (외계키 x_position, sample_id1_value1 tinyint, sample_id1_value2 float, sample_id2_value1 tinyint, sample_id2_value2 float, ...)

그런 다음 도메인별 세부 정보를 기반으로 (sample_id1_value1, sample_id1_value2, ...) 열의 작은 부분 집합에 합성 인덱스를 만듭니다.이 표에는 5,000억 행보다 더 나은 것처럼 보이는 1억 행 x 10,000 열(열 제한을 피하기 위해 여러 표에 걸쳐 분할됨)이 있습니다.또한 쿼리에서 "or" 및 "group by" 절을 사용할 필요가 없어지므로 쿼리를 다음과 같이 다시 쓸 수 있습니다.

select  column1, column2, column3... sample_id,
        sample_id1_value1,
        sample_id1_value2
    from  table1, table2
    where  column1 = string1
      and  column2 < float2
      and  sample_id1_value1=1
      and  sample_id2_value1=0
      and  sample_id3_value1=1
      and  sample_id1_value2 < float1
      and  sample_id2_value2 < float1
      and  sample_id3_value2 < float1; 

불행히도 "키가 너무 많다"는 오류가 이를 방해하고 있습니다.

언급URL : https://stackoverflow.com/questions/30835430/workaround-for-too-many-keys-specified-max-64-keys-allowed-error-in-mariadb