Calculate the size of your index
To determine how many shards your index requires, calculate your index size and then apply the number of shards formula.Index size
A document in a document index can include any combination ofstring fields with full_text_search enabled, a dense vector, and a sparse vector. A record in a vector index can include a dense vector, a sparse vector, or both. Use the formula that matches your index to calculate total size:
- Document index
- Index of dense vectors
- Index of sparse vectors
- Index with both dense and sparse vectors
A document index contains documents. Each document’s size is its ID, its metadata, and the data in every schema field it holds.Where:
Calculate size
ID sizeandMetadata sizeare measured in bytes, averaged across all documents. Metadata is every field that isn’t declared in the schema.Total full-text-search field size: The combined UTF-8 byte length of the text in allstringfields withfull_text_searchenabled, averaged across all documents. Astringfield with integrated embedding stores its text, which counts here, unless it setsstore_text: false, in which case only its generated vector counts. If a field has both, count its text here and its generated vector below.- Each
Dense vector dimensionuses 4 bytes. Sum the dimensions of every dense vector in the document, whether you upsert it or Pinecone generates it for an integrated-embedding field. Omit this term if the schema has no dense vector. Number of non-zero sparse values: Average number across all documents, including those without sparse vectors. Count every sparse vector in the document, whether you upsert it or Pinecone generates it. Each non-zero value uses 8 bytes. Omit this term if the schema has no sparse vector.
Example: 1,000,000 documents × (8-byte ID + 5,000 bytes of full-text-search text + (1024 dense vector dimensions × 4 bytes) + 1,000 bytes of metadata) = 10.1 GB
Number of shards
To calculate the number of shards your index requires, divide the size of your index by 250 GB and round up:Example shard calculations
Other considerations
- Every index must have at least one shard. However, you can pause an index by reducing its replicas to 0.
- After you’ve created your index, monitor its fullness.
Add shards when index fullness reaches 70-80%, especially if you expect continued growth. Adding shards reduces storage fullness (index data is spread across shards, so each stores less) and memory fullness (with less data per shard, there’s less to cache in memory), helping you avoid write failures.
Number of replicas
To calculate the number of replicas your index requires, first test your workload to find the QPS a single replica can handle at your target latency. Then, use this formula, and round up:Test your workload
To choose between on-demand and dedicated read nodes, or to optimize your dedicated read nodes configuration, test with your actual workload. Performance varies based on factors such as the size of your index, vector dimensionality, metadata characteristics, and query patterns.1
Calculate the size of your index
Determine how many shards your index requires. See Calculate the size of your index.
2
Create and populate a test index
Populate a dedicated read nodes index with data representative of your workload.
3
Migrate your test index to dedicated read nodes (if necessary)
If your test index is on-demand, migrate it with a single
b1 replica to start.4
Run a load test
Send realistic query patterns against your test index, gradually increasing QPS. For example, start at 10 QPS for about 30 minutes, then step up in 10-QPS increments while monitoring latency. Note the QPS where latency crosses your target threshold.
5
Calculate replicas
From the QPS a single replica sustained, determine how many replicas you need for your target throughput.
6
Adjust and re-test
If you haven’t hit your performance and cost goals, change the configuration and test again:
- Add or remove shards for storage capacity
- Add or remove replicas for throughput
- Change node types for different performance characteristics