Skip to main content

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 of string 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:
A document index contains documents. Each document’s size is its ID, its metadata, and the data in every schema field it holds.
Calculate size
Where:
  • ID size and Metadata size are 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 all string fields with full_text_search enabled, averaged across all documents. A string field with integrated embedding stores its text, which counts here, unless it sets store_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 dimension uses 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.
These examples assume 8-byte IDs:
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:
To maintain optimal performance, provision additional shards to keep your index at 70-80% capacity. For example, a 500 GB index should have three shards (750 GB capacity = 67% full), not two shards (500 GB capacity = 100% full).

Example shard calculations

Other considerations

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:
For example, if one replica handles 50 QPS at your target latency and you need 150 QPS, you need three replicas. For how throughput scales with replicas and how to size for high availability, see Replicas.

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.
If you don’t restore your test index from a backup, you can upsert or import your data.
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.
Don’t migrate your production index yet. At this point, you’re just testing your workload.
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:Continue iterating until you meet your requirements with room for growth.