Parameter | When to use | Description |
lists | specified when creating indexes, used during insert |
|
ivfflat.probes | Specified during query, used for index scanning. | The minimum value is 1, the maximum value is 32768, and the default value is 1. It represents the number of lists searched during the current index scan. The larger this value, the more lists are scanned in search, resulting in a higher recall, but the index scan efficiency decreases; conversely, the smaller this value, the fewer lists are scanned, leading to lower recall but improved index scan efficiency. If this value is greater than the lists value specified when creating the index, query optimization will ignore the index and choose a full table scan. At this point, query performance may decrease. |
ivfflat.iterative_scan | Specified during query, used for index scanning. | Optional values are "off" or "relaxed_order". If set to "relaxed_order", the index scan range expands during queries, achieving higher recall at the cost of more time. |
ivfflat.max_probes | Specified during query, used for index scanning. | minimum value is 1, maximum value is 32768, default value is 32768. ivfflat.iterative_scan takes effect when set to "relaxed_order". During this index scanning process, the maximum number of search lists is max(ivfflat.probes, ivfflat.max_probes). |
Parameter | When to use | Description |
m | specified when creating indexes, used during insert | Indicates the number of connections each point needs to establish with other points in the graph. The minimum value of m is 2, the maximum value is 100, and the default value is 16. Generally, the larger the value of m, the higher the recall rate and the greater the memory consumption. The smaller the value of m, the shorter the build time. |
ef_construction | specified when creating indexes, used during insert | Represents the size of the dynamic candidate set during index building. The minimum value of ef_construction is 4, the maximum value is 1000, and the default value is 64. ef_construction must be greater than m, typically set to twice the value of m. For clustered data, ef_construction typically performs better when set to a larger value. The larger the value of ef_construction, the slower the index builds. |
hnsw.ef_search | Specified during query, used for index scanning. | This parameter is used during querying to limit the maximum return record quantity and accuracy. The minimum value of hnsw.ef_search is 1, the maximum value is 1000, and the default value is 40. for example, setting the hnsw.ef_search value to 40 means the query will only return 40 rows, even if you attempt to query 100 nearest neighbor records. usually the larger the hnsw.ef_search, the higher the search accuracy, but the longer the time consumed. |
hnsw.iterative_scan | Specified during query, used for index scanning. | Optional values are "off", "relaxed_order", or "strict_order". If set to "relaxed_order" or "strict_order", the index scan range expands during queries to achieve a higher recall rate but consumes more time. |
hnsw.max_scan_tuples | Specified during query, used for index scanning. | minimum value is 1, default value is 20000, limits the maximum tuple quantity accessed during index scan expansion. |
hnsw.scan_mem_multiplier | Specified during query, used for index scanning. | minimum value is 1, maximum value is 1000, default value is 1; it sets the multiplier for work_mem used during extended index scans |
Parameter | Description |
max_parallel_workers | set the system's maximum parallel process quantity, default value is 8. |
max_parallel_maintenance_workers | Sets the maximum number of parallel workers for a single utility command (such as CREATE INDEX). |
maintenance_work_mem | specifies the maximum memory used for maintenance actions (such as VACUUM, create index). |
convert type | Examples |
convert vector to vector | |
convert vector to real[] | |
convert real[ ] to vector | |
convert int4[ ] to vector | |
Convert double precision[ ] to vector | |
convert numeric[ ] to vector | |
test parameter | |
test concurrency | 6/16 |
Number of test threads | 1/4 |
test time | 60s |
PostgreSQL instance specification | single AZ with one primary and one standby 32C64G |
client specification | 32 vCPU 128 GiB high-speed SSD PL0 40 GiB |
Test steps | statement |
Create extension | |
creating tables and indexes | |
Create functions to generate embedding data with specified dimensions | |
Import 100,000 data entries | |
pg_bench stress test SQL statement: vtest.sql | |
pgbench execution | |
Import 200,000 data entries | |
import 400,000 records | |
import 600,000 data records | |
import 800,000 entries | |
import 1 million data entries | |