S
S
simonnik2016-10-26 11:57:41
PostgreSQL
simonnik, 2016-10-26 11:57:41

PostgreSQL - why does the index not work on 50000 records?

Greetings, dear connoisseurs!!!
Such a situation: there is a table foo with columns id, active, field_id1, field_id2 and there is a composite index foo_field_id1_active with fields field_id1, acitve. Query for 10,000 records
EXPLAIN SELECT * FROM foo WHERE filed_id1=4444 AND active=1
Indicates that the index is in use, but at 50,000 records it is no longer used even after VACUUM ANALIZE foo;
About 1,000,000 records, I generally keep quiet.
And so the question is: which artist, the index is no longer used?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2016-10-26
@simonnik

Postgresql considered that seq scan would be faster.
Why don't they use my indexes?

R
romy4, 2016-10-26
@romy4

And so the question is: which artist, the index is no longer used?
Malevich

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question