Skip to content

Conversation

@YeunjunLee
Copy link
Contributor

@YeunjunLee YeunjunLee commented Dec 19, 2025

http://jira.cubrid.org/browse/CUBVEC-142

Purpose

System Catalog의 BTREE_STATS에 B+Tree Index에 대한 통계정보만 담도록 수정한다.
이를 위해 Object Repesentation에 Index Type에 대한 정보를 추가로 지원한다.

Implementation

  • OR_ATTRIBUTE에 Index Type 정보 추가
    • 기존의 BTID만 저장하던 방식에서 OR_ATTRIBUTE_INDEX로 변경
    • OR_ATTRIBUTE 구조를 사용하던 기존 코드들의 BTID 획득 방식 변경
  • System Catalog (DISK_REPR)의 BTREE_STATS에 오직 B+Tree 정보만을 포함
    • OR_ATTRIBUTE에 추가된 Index Type 정보를 확인하여 B+Tree인 경우에만 추가되도록 변경
  • 기존의 BTID를 통해 Vector Index Type을 확인하던 코드들 변경 (BTID_IS_VECTOR_INDEX)
    • Vector Index가 더 이상 NULL value를 가지고 있지 않기 때문에, 해당 로직으로 판단 불가능
    • 해당 로직들 중 대부분은 OR_INDEXBTID를 인자로 받기 때문에, OR_INDEXBTREE_TYPE 값을 통해 Index Type 구분이 가능하다.
    • 이는 Insert / Select 동작을 정상적으로 돌려놓기 위해 필요한 변경사항임

Remarks

해당 변경을 통해 아래와 같은 TC가 모두 정상적으로 작동한다.

DROP IF EXISTS test_empty_table;
CREATE TABLE test_empty_table (
    id INT,
    vector_data VECTOR(3)
);

CREATE VECTOR INDEX idx_vector_index ON test_empty_table(vector_data EUCLIDEAN);
CREATE INDEX idx_normal_index ON test_empty_table(id);

INSERT INTO test_empty_table VALUES (1, '[1,2,3]');
INSERT INTO test_empty_table VALUES (2, '[1,0,2]');
INSERT INTO test_empty_table VALUES (3, '[3,4,5]');
INSERT INTO test_empty_table VALUES (4, '[0,0,1]');
INSERT INTO test_empty_table VALUES (5, '[5,6,7]');
INSERT INTO test_empty_table VALUES (6, '[9,8,7]');
INSERT INTO test_empty_table VALUES (7, '[1,1,0]');
INSERT INTO test_empty_table VALUES (8, '[0,1,0]');
INSERT INTO test_empty_table VALUES (9, '[1,1,1]');
INSERT INTO test_empty_table VALUES (10, '[1,0,1]');
INSERT INTO test_empty_table VALUES (11, '[2,3,4]');
INSERT INTO test_empty_table VALUES (12, '[1,1,1]');


set trace on;

SELECT id FROM test_empty_table ORDER by l2_distance(vector_data, '[0,0,0]') LIMIT 3;

show trace;  -- VECTOR INDEX SCAN

DROP INDEX idx_vector_index ON test_empty_table(vector_data);

@YeunjunLee YeunjunLee self-assigned this Dec 19, 2025
@YeunjunLee YeunjunLee changed the title Change internal catalog structures for considering Vector Index [CUBVEC-142] Change internal catalog structures for considering Vector Index Dec 23, 2025
@YeunjunLee YeunjunLee marked this pull request as ready for review December 23, 2025 08:12
@YeunjunLee YeunjunLee requested a review from a team as a code owner December 23, 2025 08:12
@YeunjunLee YeunjunLee requested review from hgryoo, hornetmj, mhoh3963 and vimkim and removed request for a team December 23, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants