Re: Optimizing a condition based on an a very unequally distributed value.

Поиск
Список
Период
Сортировка
От Nick Fankhauser
Тема Re: Optimizing a condition based on an a very unequally distributed value.
Дата
Msg-id NEBBLAAHGLEEPCGOBHDGEENMEIAA.nickf@ontko.com
обсуждение исходный текст
Ответ на Re: Optimizing a condition based on an a very unequally  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: Optimizing a condition based on an a very unequally
Список pgsql-admin
Thanks for the answer! ...but now I have more questions:

Is it true that if I use this condition in a join that further constrains
the results, this might use the index?

Does PGSQL know that few or many rows will be returned because of data
gathered from the last vacuum?

What do you mean by "tuple validity?" can't this query be resolved entirely
based on the index?

-Nick
> -----Original Message Snips:-----

> > So my question in general is why does PGSQL opt to use the index when
> > looking for the single field row, and not use it when looking
> for the other
> > 23768 rows?
>
> Because in many cases the sequence scan will be faster than an index scan
> when you're trying to get most of the rows of the table. Since the tuple
> validity is in the table row and not the index, it's still got to check
> the table which would involve lots of random reads into that file, so
> you're doing even more disk operations and less efficient ones.
>


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

Предыдущее
От: groups@paperstack.com (Dave Minter)
Дата:
Сообщение: denying CREATE TABLE
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Optimizing a condition based on an a very unequally