Is PostgreSQL SELECT speed adversely affected by too many indexes in the table?

I read that having many indexes in the database can seriously hurt performance, but I can not find anything in the PostgreSQL document.

I have a very large table with something like 100 columns and a billion rows, and often I have to search a lot in different fields.

Will the performance of a PostgreSQL table decrease if I add a lot of indexes (maybe 10 unique column indexes and 5 or 7 columns)?

EDIT: with a decrease in performance, I mean performance when typing rows (select), the database will be updated once a month, so updating and inserting time are not a problem.

+6
source share
3 answers

Indexes are saved when the contents of the table have been changed (i.e., INSERT , UPDATE , DELETE )

The PostgreSQL query planner can decide when to use the index and when it is not needed, and sequential scanning is more optimal.

Thus, too many indexes will affect performance changes, not choices.

+6
source

Indexes must be updated with every insert and update that includes these columns.

+1
source

I have some diagrams about this on my website: http://use-the-index-luke.com/sql/dml

An index is pure redundancy. It contains only data that is also stored in a table. During write operations, the database must retain these abbreviations. In particular, this means that inserting, deleting, and updating not only affects the table, but also indexes that contain a copy of the affected data.

The titles of the chapters suggest that indexes can have:

Insertion - cannot directly benefit from indices

Delete - uses indexes for where clause

Update - does not affect all table indices

0
source

Source: https://habr.com/ru/post/926444/


All Articles