Re: Slow query: bitmap scan troubles

Поиск
Список
Период
Сортировка
От
Тема Re: Slow query: bitmap scan troubles
Дата
Msg-id 097601cdd249$ae338530$0a9a8f90$@foo.me.uk
обсуждение исходный текст
Ответ на Re: Slow query: bitmap scan troubles  (Jeff Janes <jeff.janes@gmail.com>)
Ответы Re: Slow query: bitmap scan troubles  (Claudio Freire <klaussfreire@gmail.com>)
Re: Slow query: bitmap scan troubles  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-performance
> But the row estimates are not precise at the top of the join/filter.
> It thinks there will 2120 rows, but there are only 11.

> So it seems like there is a negative correlation between the two tables
which is not recognized.

Yes, you are right there. I am only just beginning to understand how to
parse these explain reports.. As I mentioned above, I probably picked a bad
example to run that query on 11 is an unusually low number of results to get
back, a few thousand would be more normal.

Though that doesn't account for the 70x difference between the speed of the
two queries in actuality given a pretty similar expected speed (does it?).
It does go some way to explaining why a bad choice of plan was made.

Is there some nice bit of literature somewhere that explains what sort of
costs are associated with the different types of lookup? I have found bits
and bobs online but I still don't have a really clear idea in my head what
the difference is between a bitmap index scan and index only scan is, though
I can sort of guess I don't see why one would be considered more likely to
use the disk than the other.

On the 'slow' query (with the better predicted score)
>> First, make sure caching isn't interfering with your results. Run each
>> query several times.
> If that is not how the production system works (running the same query
over and over) then you want to model the cold cache, not the hot one.
> But in any case, the posted explains indicates that all buffers were
cached.

We are in the rather pleasant situation here in that we are willing to spend
money on the box (up to a point, but quite a large point) to get it up to
the spec so that it should hardly ever need to touch the disk, the trick is
figuring out how to let our favourite database server know that.

I've just discovered pgtune and am having some fun with that too.

Cheers,

Phil



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

Предыдущее
От:
Дата:
Сообщение: Re: Slow query: bitmap scan troubles
Следующее
От: Claudio Freire
Дата:
Сообщение: Re: Slow query: bitmap scan troubles