neondatabase / pg_embedding

Hierarchical Navigable Small World (HNSW) algorithm for vector similarity search in PostgreSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] after build index ;insert error

GPF199541 opened this issue · comments

Environment

postgresql15.2

Logs, links

test_db=# \d test_vectors_embedding_hnsw2
                                Table "public.test_vectors_embedding_hnsw2"
 Column |      Type      | Collation | Nullable |                         Default                          
--------+----------------+-----------+----------+----------------------------------------------------------
 id     | bigint         |           | not null | nextval('test_vectors_embedding_hnsw2_id_seq'::regclass)
 emb    | real[]         |           |          | 
 biz    | character(255) |           |          | 
 pic    | character(255) |           |          | 
 url    | character(700) |           |          | 
 cls    | character(2)   |           |          | 
 loc    | character(128) |           |          | 
Indexes:
    "test_vectors_embedding_hnsw2_pkey" PRIMARY KEY, btree (id)
    "test_vectors_embedding_hnsw2_emb_idx" disk_hnsw (emb) WITH (dims='256', m='32')

test_db=# Drop index test_vectors_embedding_hnsw2_emb_idx;
DROP INDEX
test_db=# INSERT INTO test_vectors_embedding_hnsw2 (emb, pic, url) VALUES ('{-1.3577173, -0.1931086, -2.054078, -1.0216528, -0.2908677, 0.0417148, -1.275564, 0.3681692, 0.6960625, -0.4160977, -1.022937, -0.3357292, -1.7334518, 0.6310615, -0.9466465, 0.2149753, -0.0170873, -0.2950798, 1.0806773, -1.2019562, -0.4723569, 0.280157, -0.1214862, -0.5946828, -0.8663544, -0.2719779, 0.1970003, -1.000358, -0.7949438, -0.8798426, 0.9840588, -0.819663, -0.6153127, -0.0383352, 0.0031938, 0.2136006, -0.8936025, 1.8357444, -1.4972517, 0.5109758, -0.9384633, -0.7397373, 0.1170649, -0.8619239, -0.4392602, -0.4289132, 0.1355756, 0.1290145, -0.9775255, -2.0477536, -0.3968557, -0.8216435, 0.8082756, -0.4985549, -0.1131888, 1.6151655, 1.0111067, 0.5304176, -1.2303437, -0.5870577, 0.1953384, 0.4804874, 0.5157396, -0.5184563, -1.1904018, -0.6855107, 1.1018984, 0.9297467, -0.0623092, -0.151415, -0.0986392, -0.7027535, -1.9203912, -0.2652288, -0.3080295, -1.0096159, -0.8962705, 0.7063244, -1.352454, -0.2865452, -0.8807335, 0.9797034, -0.0904295, 1.334077, -0.7468812, 2.2190342, 1.162147, 0.3164219, 0.1395898, -1.0999525, -1.1906483, -1.0920788, 0.0463939, -0.4177737, -0.1881599, -0.4334898, -0.2400387, 0.9126538, 0.8113637, 0.4602213, -0.3553045, -0.9312688, 0.491594, 1.7958134, -0.5205359, -1.7871464, -0.8688284, -0.289492, -0.2719598, 0.8960803, -0.7156042, -0.7482584, 1.4487717, -1.6332766, -0.0701321, -0.2844273, -0.3483454, 0.6967442, -0.082129, 0.3499782, 0.231226, -0.9935235, 0.5810836, -0.7631179, 0.5115957, -0.4710389, 2.7917955, 0.8310192, -1.0967236, 1.3042188, -0.0621228, 0.9727247, 1.5298697, -0.4735105, 0.8201959, -1.6014637, -0.4435724, 0.1150684, -2.3777487, -0.092687, 1.64431, -1.3853956, -2.3693242, 0.2795227, 1.4520471, 0.7070943, -1.1565708, -1.8917516, 0.178189, 0.0070163, 0.3306862, -0.5251174, -0.666474, 0.7975529, -0.4793687, 0.4736622, 0.1003931, -0.2413153, 0.4790334, 0.4233853, -0.3626219, -1.7925045, -0.0311574, -0.771827, 0.5282623, -0.590151, -0.4058989, 1.0258397, 0.4007719, 0.331128, -0.4066766, -0.8737853, 0.3456081, -0.6774357, -0.5742541, 1.3907764, -1.8045238, 1.0758289, -2.2130907, 0.9411963, -1.0718011, -2.4546704, 0.2509904, -0.5624139, 0.4104578, -0.7894603, 0.3795136, 1.8772784, -1.3694749, 0.9232821, 0.6553418, -0.1282401, 0.5815499, 0.4233072, 0.3157484, -0.135366, -0.020872, -0.793581, -0.9765639, -0.0791832, 0.3738998, 1.5921856, -1.0544736, 0.6868084, 1.0082403, 0.1005407, 1.0620728, -0.2379073, 0.0730326, -0.1270735, -1.7749763, -0.2000193, 0.7045384, -0.7347514, -0.7330724, 1.645151, -0.0203024, 0.5865587, -0.7982014, 0.3127671, 0.2199927, -0.7628009, 0.2664881, -0.263574, -1.166938, 0.3191151, -0.2087096, -1.3463137, 1.0447439, 0.8546895, -1.0444397, 1.1071848, 0.1644423, 0.923902, 0.3043146, 0.0062285, 1.0722132, -0.0621383, -0.2353123, 1.0340056, 0.5977604, 0.532452, 0.2615763, 0.2707317, 0.9625043, 0.750101, 0.7676484, 1.4126079, -1.1933744, -1.0857062, 0.7211734, -1.0081924, -0.051911, -0.1272659, -0.160972, 0.7146422}','--', '--')
test_db-# ;
INSERT 0 1
test_db=# CREATE INDEX ON test_vectors_embedding_hnsw2 USING disk_hnsw (emb ann_l2_ops) WITH (dims=256, m=32);
CREATE INDEX
test_db=# \d test_vectors_embedding_hnsw2
                                Table "public.test_vectors_embedding_hnsw2"
 Column |      Type      | Collation | Nullable |                         Default                          
--------+----------------+-----------+----------+----------------------------------------------------------
 id     | bigint         |           | not null | nextval('test_vectors_embedding_hnsw2_id_seq'::regclass)
 emb    | real[]         |           |          | 
 biz    | character(255) |           |          | 
 pic    | character(255) |           |          | 
 url    | character(700) |           |          | 
 cls    | character(2)   |           |          | 
 loc    | character(128) |           |          | 
Indexes:
    "test_vectors_embedding_hnsw2_pkey" PRIMARY KEY, btree (id)
    "test_vectors_embedding_hnsw2_emb_idx" disk_hnsw (emb) WITH (dims='256', m='32')

test_db=# INSERT INTO test_vectors_embedding_hnsw2 (emb, pic, url) VALUES ('{-1.3577173, -0.1931086, -2.054078, -1.0216528, -0.2908677, 0.0417148, -1.275564, 0.3681692, 0.6960625, -0.4160977, -1.022937, -0.3357292, -1.7334518, 0.6310615, -0.9466465, 0.2149753, -0.0170873, -0.2950798, 1.0806773, -1.2019562, -0.4723569, 0.280157, -0.1214862, -0.5946828, -0.8663544, -0.2719779, 0.1970003, -1.000358, -0.7949438, -0.8798426, 0.9840588, -0.819663, -0.6153127, -0.0383352, 0.0031938, 0.2136006, -0.8936025, 1.8357444, -1.4972517, 0.5109758, -0.9384633, -0.7397373, 0.1170649, -0.8619239, -0.4392602, -0.4289132, 0.1355756, 0.1290145, -0.9775255, -2.0477536, -0.3968557, -0.8216435, 0.8082756, -0.4985549, -0.1131888, 1.6151655, 1.0111067, 0.5304176, -1.2303437, -0.5870577, 0.1953384, 0.4804874, 0.5157396, -0.5184563, -1.1904018, -0.6855107, 1.1018984, 0.9297467, -0.0623092, -0.151415, -0.0986392, -0.7027535, -1.9203912, -0.2652288, -0.3080295, -1.0096159, -0.8962705, 0.7063244, -1.352454, -0.2865452, -0.8807335, 0.9797034, -0.0904295, 1.334077, -0.7468812, 2.2190342, 1.162147, 0.3164219, 0.1395898, -1.0999525, -1.1906483, -1.0920788, 0.0463939, -0.4177737, -0.1881599, -0.4334898, -0.2400387, 0.9126538, 0.8113637, 0.4602213, -0.3553045, -0.9312688, 0.491594, 1.7958134, -0.5205359, -1.7871464, -0.8688284, -0.289492, -0.2719598, 0.8960803, -0.7156042, -0.7482584, 1.4487717, -1.6332766, -0.0701321, -0.2844273, -0.3483454, 0.6967442, -0.082129, 0.3499782, 0.231226, -0.9935235, 0.5810836, -0.7631179, 0.5115957, -0.4710389, 2.7917955, 0.8310192, -1.0967236, 1.3042188, -0.0621228, 0.9727247, 1.5298697, -0.4735105, 0.8201959, -1.6014637, -0.4435724, 0.1150684, -2.3777487, -0.092687, 1.64431, -1.3853956, -2.3693242, 0.2795227, 1.4520471, 0.7070943, -1.1565708, -1.8917516, 0.178189, 0.0070163, 0.3306862, -0.5251174, -0.666474, 0.7975529, -0.4793687, 0.4736622, 0.1003931, -0.2413153, 0.4790334, 0.4233853, -0.3626219, -1.7925045, -0.0311574, -0.771827, 0.5282623, -0.590151, -0.4058989, 1.0258397, 0.4007719, 0.331128, -0.4066766, -0.8737853, 0.3456081, -0.6774357, -0.5742541, 1.3907764, -1.8045238, 1.0758289, -2.2130907, 0.9411963, -1.0718011, -2.4546704, 0.2509904, -0.5624139, 0.4104578, -0.7894603, 0.3795136, 1.8772784, -1.3694749, 0.9232821, 0.6553418, -0.1282401, 0.5815499, 0.4233072, 0.3157484, -0.135366, -0.020872, -0.793581, -0.9765639, -0.0791832, 0.3738998, 1.5921856, -1.0544736, 0.6868084, 1.0082403, 0.1005407, 1.0620728, -0.2379073, 0.0730326, -0.1270735, -1.7749763, -0.2000193, 0.7045384, -0.7347514, -0.7330724, 1.645151, -0.0203024, 0.5865587, -0.7982014, 0.3127671, 0.2199927, -0.7628009, 0.2664881, -0.263574, -1.166938, 0.3191151, -0.2087096, -1.3463137, 1.0447439, 0.8546895, -1.0444397, 1.1071848, 0.1644423, 0.923902, 0.3043146, 0.0062285, 1.0722132, -0.0621383, -0.2353123, 1.0340056, 0.5977604, 0.532452, 0.2615763, 0.2707317, 0.9625043, 0.750101, 0.7676484, 1.4126079, -1.1933744, -1.0857062, 0.7211734, -1.0081924, -0.051911, -0.1272659, -0.160972, 0.7146422}','--', '--');
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
!?> 

the postgresql.log

2023-08-02 16:54:01.122 CST 2286052     LOG:  database system is ready to accept connections
2023-08-02 16:57:56.487 CST 2286052     LOG:  server process (PID 2307560) exited with exit code 245
2023-08-02 16:57:56.487 CST 2286052     LOG:  terminating any other active server processes
2023-08-02 16:57:56.500 CST 2286052     LOG:  all server processes terminated; reinitializing
2023-08-02 16:57:57.072 CST 2308083     LOG:  database system was interrupted; last known up at 2023-08-02 16:54:01 CST
2023-08-02 16:57:57.249 CST 2308083     LOG:  database system was not properly shut down; automatic recovery in progress
2023-08-02 16:57:57.251 CST 2308083     LOG:  redo starts at 558/62D71628
2023-08-02 16:57:57.340 CST 2308083     LOG:  invalid record length at 558/62D80F00: wanted 24, got 0
2023-08-02 16:57:57.340 CST 2308083     LOG:  redo done at 558/62D80ED8 system usage: CPU: user: 0.04 s, system: 0.04 s, elapsed: 0.08 s
2023-08-02 16:57:57.344 CST 2308084     LOG:  checkpoint starting: end-of-recovery immediate wait
2023-08-02 16:57:57.501 CST 2308084     LOG:  checkpoint complete: wrote 30 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.147 s, sync=0.004 s, total=0.159 s; sync files=20, longest=0.003 s, average=0.001 s; distance=62 kB, estimate=62 kB
2023-08-02 16:57:57.512 CST 2286052     LOG:  database system is ready to accept connections

Thank you for reporting the problem.
Fixed.