Skip to content

Add table quantization option for pgvector#427

Merged
alwayslove2013 merged 1 commit intozilliztech:mainfrom
intel-staging:pgvector_table_quantization
Mar 7, 2025
Merged

Add table quantization option for pgvector#427
alwayslove2013 merged 1 commit intozilliztech:mainfrom
intel-staging:pgvector_table_quantization

Conversation

@lucagiac81
Copy link
Copy Markdown
Contributor

This PR adds a table quantization option for pgvector.

  • The table_quantization_type option controls quantization of data as it is loaded into the database.
  • This is in addition to the existing quantization_type option which controls quantization of data in an index.

Quantizing data as it is loaded enables storage savings if the original float vectors do not need to be preserved for other purposes. For example, halfvec quantization could be used in both the table and index, reducing the size of the table and eliminating the need for conversions.

table_quantization_type supports the same quantization options as quantization type: none, halfvec, bit.
Most combinations of the two options are supported, with some exceptions.

  • If table_quantization_type = bit, then quantization type is forced to bit as well, as it does not make sense to convert bit vectors in the table to vector or halfvec in an index.
  • Reranking is only supported if quantization_type = bit and table_quantization_type is vector or halfvec.

@lucagiac81 lucagiac81 force-pushed the pgvector_table_quantization branch from 68c0f59 to da2155b Compare March 6, 2025 18:20
@lucagiac81 lucagiac81 marked this pull request as ready for review March 6, 2025 18:23
@lucagiac81
Copy link
Copy Markdown
Contributor Author

Rebased on latest main.

Below are the configurations verified with runs from cli.

  • Case: Performance1536D500K
  • Table size: pg_vector_collection size reported by psql \d+
  • Index size: pgvector_index size reported by psql \di+
Table quantization Index quantization Table size (MB) Index size (MB)
none (vector) none (vector) 3908 3906
none (vector) halfvec 3908 1953
none (vector) bit 3908 239
halfvec none (vector) 1954 3906
halfvec halfvec 1954 1953
halfvec bit 1954 239
bit bit 115 239

@lucagiac81
Copy link
Copy Markdown
Contributor Author

Formatting checks are failing for files not modified by this PR. Would you like me to fix them in this PR? If they are fixed in a separate PR, I will rebase on it.

PYTHONPATH=`pwd` python3 -m black vectordb_bench --check
would reformat /home/runner/work/VectorDBBench/VectorDBBench/vectordb_bench/backend/clients/milvus/config.py
would reformat /home/runner/work/VectorDBBench/VectorDBBench/vectordb_bench/backend/clients/milvus/cli.py

@lucagiac81
Copy link
Copy Markdown
Contributor Author

/assign @XuanYang-cn

@sre-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akashsha1, alwayslove2013, lucagiac81
To complete the pull request process, please assign xuanyang-cn after the PR has been reviewed.
You can assign the PR to them by writing /assign @xuanyang-cn in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@alwayslove2013
Copy link
Copy Markdown
Contributor

@lucagiac81 I will check it.

Formatting checks are failing for files not modified by this PR.

@alwayslove2013 alwayslove2013 merged commit 7bda989 into zilliztech:main Mar 7, 2025
0 of 4 checks passed
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.

4 participants