From: xiaojunxiang2023 (@xiaojunxiang2023) <noreply+xiaojunxiang2023@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #810: Inserting into a pgvector table with an HNSW index is very slow, And update more slow
Date: Fri, 28 Mar 2025 03:54:32 +0000
Message-ID: <gh-pgvector-pgvector-810-c2760113457@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-810@github.com>
References: <gh-pgvector-pgvector-810@github.com>
> Please include the output of `(ANALYZE, BUFFERS)`, not just `ANALYZE`.
>
> Also, what's the output of `\d light_test_db.light_test_table`?
>
> (please include both as code blocks instead of screenshots)
OK, more info as follow:
```
EXPLAIN (ANALYZE, BUFFERS)
UPDATE light_test_db.light_test_table SET txtembd_bge_m3 = '[....]'
WHERE mm_id = '4da4058fd6b7ec1bd303c404b6611355d916517eac0a91afa06f4027096db5db';
```
```
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Update on light_test_table (cost=0.69..2.91 rows=0 width=0) (actual time=194.422..194.423 rows=0 loops=1)
Buffers: shared hit=31568 dirtied=2 written=2
-> Index Scan using mm_id_light_test_table_auto_index on light_test_table (cost=0.69..2.91 rows=1 width=38) (actual time=0.040..0.047 rows=1 loops=1)
Index Cond: ((mm_id)::text = '4da4058fd6b7ec1bd303c404b6611355d916517eac0a91afa06f4027096db5db'::text)
Buffers: shared hit=7
Planning:
Buffers: shared hit=17
Planning Time: 0.392 ms
Execution Time: 194.454 ms
```
\d info:
```
mme_light=# \d light_test_db.light_test_table
Table "light_test_db.light_test_table"
Column | Type | Collation | Nullable | Default
-----------------+----------------------+-----------+----------+---------
mm_id | character varying | | not null |
txtembd_bge_m3 | vector(1024) | | |
.......
.......
.......
.......
Indexes:
"light_test_table_txtembd_bge_m3" hnsw (txtembd_bge_m3 vector_l2_ops) WITH (m='16', ef_construction='64') WHERE txtembd_bge_m3 IS NOT NULL
"mm_id_light_test_table_auto_index" btree (mm_id)
.......
.......
.......
```
data rows count info:
```
mme_light=# select count(mm_id) from light_test_db.light_test_table;
count
-----------
117106226
(1 row)
mme_light=# select count(mm_id) from light_test_db.light_test_table where txtembd_bge_m3 is not null;
count
-------
3
(1 row)
```