Migrating Data

1. Planning Migration Strategy

MigrationApproach
Pod → ServerlessCollection or paginated query+upsert
Cross-regionExport → re-upsert in target
Other vector DB → PineconeRead all vectors → upsert

2. Exporting Vectors

Example: Paginate by ID Prefix

all_ids = []
for ids in index.list(prefix="", namespace="kb"):
    all_ids.extend(ids)

for chunk in batched(all_ids, 1000):
    vecs = index.fetch(ids=chunk, namespace="kb")["vectors"]
    write_to_file(vecs)

3. Importing Vectors

MethodDetail
Bulk Import (serverless)S3/GCS Parquet → start_import
SDK upsertBatched (100 vectors/batch)
CLIpinecone import

4. Migrating from Other Vector DBs

SourceSteps
WeaviateCursor through objects → upsert
QdrantScroll API → upsert
Chromacollection.get() → upsert
pgvectorSQL SELECT → upsert

5. Migrating Between Pinecone Regions

Cross-Region Migration

  1. Create index in target region.
  2. Export from source via fetch.
  3. Upsert to target in batches.
  4. Dual-write briefly.
  5. Switch reads; delete source.

6. Migrating from Pod to Serverless

Example: Via Collection

# Note: collections only work for pod indexes.
# Create collection from pod, then upsert into serverless from source data.
pc.create_collection(name="migrate", source="docs-pod")
# Use source data store (S3 parquet) to populate serverless via bulk import.

7. Performing Zero-Downtime Migration

Zero-Downtime Steps

  1. Stand up new index.
  2. Backfill historical data.
  3. Enable dual-write (old + new).
  4. Diff sample queries old vs new.
  5. Shift reads progressively.
  6. Stop writes to old; delete.

8. Validating Migration Success

CheckHow
Counts matchdescribe_index_stats both sides
Query paritySample 100 queries; compare top-K
Metadata fidelityFetch & deep-compare

9. Handling Migration Errors

ErrorMitigation
Partial failurePersist failed IDs; replay
Rate limitBackoff; reduce concurrency
Dim mismatchRe-embed source

10. Rolling Back Migrations

StateAction
Before cutoverDelete new index; nothing else
During dual-writeSwitch reads back to old
After cutoverRestore old from backup/source

11. Optimizing Migration Throughput

TipEffect
Bulk import (serverless)10-100× faster than SDK upsert
Async clientParallel batches
Multiple workersShard IDs by hash

12. Documenting Migration Process

DocDetail
RunbookStep-by-step + rollback
Validation reportCounts + sample queries diff
OwnersWho to page if issues