pg.ddx.io pgvector/pgvector GitHub issues and pull requestshelp / color / mirror / Atom feed
[pgvector/pgvector] issue #691: halfvec queries taking more time than vector 7+ messages / 3 participants [nested] [flat]
* [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 03:30 "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 0 siblings, 0 replies; 7+ messages in thread From: gs-vkrishnasrujan (@gs-vkrishnasrujan) @ 2024-10-07 03:30 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hello, Indexed ~2L embeddings using halfvec and vector using hnsw. I wanted to see the performance and quality of the outputs. The quality is same for both the indexes but the average query execution time using vector is 2.7 seconds while it is 3.9, 5.7 seconds for halfvec (checked twice) Also, when I fired 100 queries to the DB parallely, it took 66 seconds to execute the pool using vector and 172 seconds using halfvec. This statistic is the mean derived from 100 runs. I was hoping that halfvec would give better performance over vector. My embedding dimension is 2000. Clarification is much appreciated. ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 09:46 "ankane (@ankane)" <noreply+ankane@github.com> 5 siblings, 0 replies; 7+ messages in thread From: ankane (@ankane) @ 2024-10-07 09:46 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi @gs-vkrishnasrujan, search performance should be similar for `halfvec` and `vector` in many cases (@jkatz has some numbers in [this post](https://jkatz05.com/post/postgres/pgvector-scalar-binary-quantization/)), especially if all of the data fits in memory. The main benefit is `halfvec` consumes less memory and space. If `halfvec` is slower, it could be due to: - the hardware - the compiler used to compile pgvector - the compiler flags What OS and architecture are you on, and how was pgvector installed? ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 13:19 "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 5 siblings, 0 replies; 7+ messages in thread From: gs-vkrishnasrujan (@gs-vkrishnasrujan) @ 2024-10-07 13:19 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi @ankane, thanks for responding. I'm running the Postgres in a container in AWS machines. The container is running in Linux Machines. Connected to it from local via tunnelling. If the performance of the `halfvec` and the `vector` are same, is there anything in `pgvector` that I could do it get better performance with slightly lower recall? A slight improvement in the performance will help me a lot. ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 13:29 "jkatz (@jkatz)" <noreply+jkatz@github.com> 5 siblings, 0 replies; 7+ messages in thread From: jkatz (@jkatz) @ 2024-10-07 13:29 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @gs-vkrishnasrujan It's very hard to provide guidance without more specific info. A few things to help here: * How many vectors are you storing? Are you storing any other data next to the vectors? Are you querying any other data as well? Are you storing the data as `halfvec` in the table? For your tests, do you have separate tables for the `vector` and the `halfvec` data, or did you keep them in the same table? * How much memory have you allocated to the container? * Are you storing the vector using `SET STORAGE PLAIN` or just the defaults? * Are you using any indexing? * Which CPU architecture are you using (x86/ARM?) * Do you have an example query plan for each run (preferably `EXPLAIN ANALYZE`) - please redact any sensitive information. ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 16:45 "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 5 siblings, 0 replies; 7+ messages in thread From: gs-vkrishnasrujan (@gs-vkrishnasrujan) @ 2024-10-07 16:45 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> I'm storing the `vector` and `halfvec` in separate tables and I do have few other columns such as text_id, text_content etc in the table. I'm using 4gb work_memory in the DB. The purpose of the experiment was to rank IVFFLAT, HNWS and HNSW with `halfvec` so that I could use the better one among the three in production. After doing EXPLAIN ANALYZE, I have found out that I'm doing `order by desc` which is using multiple workers and doing `heap sort` and `not` using the index properly. ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 17:03 "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 5 siblings, 0 replies; 7+ messages in thread From: gs-vkrishnasrujan (@gs-vkrishnasrujan) @ 2024-10-07 17:03 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Thanks for the help @ankane @jkatz. I'm closing the issue. ^ permalink raw [nested|flat] 7+ messages in thread
* Re: [pgvector/pgvector] issue #691: halfvec queries taking more time than vector @ 2024-10-07 17:04 "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 5 siblings, 0 replies; 7+ messages in thread From: gs-vkrishnasrujan (@gs-vkrishnasrujan) @ 2024-10-07 17:04 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @gs-vkrishnasrujan closed this. ^ permalink raw [nested|flat] 7+ messages in thread
end of thread, other threads:[~2024-10-07 17:04 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-10-07 03:30 [pgvector/pgvector] issue #691: halfvec queries taking more time than vector "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 2024-10-07 09:46 ` "ankane (@ankane)" <noreply+ankane@github.com> 2024-10-07 13:19 ` "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 2024-10-07 13:29 ` "jkatz (@jkatz)" <noreply+jkatz@github.com> 2024-10-07 16:45 ` "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 2024-10-07 17:03 ` "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com> 2024-10-07 17:04 ` "gs-vkrishnasrujan (@gs-vkrishnasrujan)" <noreply+gs-vkrishnasrujan@github.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox