patternsqlMinor
postgres; do indexes automatically reindex new data?
Viewed 0 times
reindexnewpostgresautomaticallyindexesdata
Problem
If I have a bunch of rows in a Postgres table, then create an index, does the index get automatically updated if new data rows are inserted after it's creation?
Alternatively stated, is REINDEX needed only in some rarer scenarios, or whenever new data is added?
Alternatively stated, is REINDEX needed only in some rarer scenarios, or whenever new data is added?
Solution
New data gets indexed automatically. Do note however that the presence of an index will therefore slow down
inserts and updates (and deletes too of course). For tables with an extremely high volume of transactions, you have to be very careful about adding indexes. For most tables in most systems this is not an issue.reindex is rarely needed under normal circumstances. Of these rare cases, the most common is probably "bloat" caused by lots of mutations -- usually when those mutations cause data on the disk to be removed from the "middle" and added to the "end".Context
StackExchange Database Administrators Q#219917, answer score: 9
Revisions (0)
No revisions yet.