pgvector / pgvector-python

pgvector support for Python
MIT License
886 stars 61 forks source link

How to rebuild indexes with Django? #41

Closed lesser-panda closed 10 months ago

lesser-panda commented 10 months ago

Newbie questions here,

I am planning to use pgvector with Django. I am wondering how should I rebuild a IVFFLAT or HNSW index as I add more embeddings to the database?

ankane commented 10 months ago

Hi @lesser-panda, indexes are updated incrementally, so you shouldn't need to reindex in many cases, but if needed, you can run:

REINDEX INDEX CONCURRENTLY index_name;

https://www.postgresql.org/docs/current/sql-reindex.html

lesser-panda commented 10 months ago

Hi @lesser-panda, indexes are updated incrementally, so you shouldn't need to reindex in many cases, but if needed, you can run:

REINDEX INDEX CONCURRENTLY index_name;

https://www.postgresql.org/docs/current/sql-reindex.html

@ankane Thanks for the quick reply! Very helpful.