Answer the question
In order to leave comments, you need to log in
How to speed up the search?
There is a table in it with about 5 million rows, it is completely static (We don’t write or edit anything into it, we only read it), what tips can you give to speed up the search in the table? (The only thing we did was add an index)
A standard query looks something like this:SELECT * FROM words WHERE word = 'привет'
Answer the question
In order to leave comments, you need to log in
Think about whether you really need select *
If not, and you need to get one or two fields - request only the necessary fields and add them to the index. In include for postgresql 11+ or in the index itself after word. Given the static nature of the table itself, there will always be an index-only scan.
If everyone is needed, then in principle it is possible to drive it into the index, but it is unlikely that this will make sense.
You can also try with a hash index if postgresql 10+. But I doubt it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question