Re: query planner not using the correct index

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: query planner not using the correct index
Дата
Msg-id 27696.1218143560@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: query planner not using the correct index  ("Joshua Shanks" <jjshanks@gmail.com>)
Ответы Re: query planner not using the correct index
Список pgsql-performance
"Joshua Shanks" <jjshanks@gmail.com> writes:
> It seems obvious that the stats on attr1 at the current level are
> inaccurate as there are over 100,000 unique enteries in the table.

Well, you haven't told us how big any of these tables are, so it's
hard to tell if the n_distinct value is wrong or not ... but in
any case I don't think that the stats on attr1 have anything to do
with your problem.  The reason that the "fast" query is fast is that
it benefits from the fact that there's only one bars row with
bars_id = 12345.  So the question is how many such rows does the
planner now think there are (try "explain analyze select * from bars
where bars_id = 12345"), and if it's badly wrong, then you need to be
looking at the stats on bars.bars_id to find out why.

            regards, tom lane

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Query Plan choice with timestamps
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: file system and raid performance