Re: seq vs index scan in join query

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Emanuel Alvarez <ema(at)abductedcow(dot)com(dot)ar>, pgsql-general(at)postgresql(dot)org
Subject: Re: seq vs index scan in join query
Date: 2017-11-29 20:03:40
Message-ID: 1511985820.6899.5.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andres Freund wrote:
> On 2017-11-29 18:17:18 +0100, Laurenz Albe wrote:
> > That is because the execution with the sequential scan touched
> > 26492 + 80492 = 106984 blocks, while the second execution touched
> > 311301 + 48510 = 359811 blocks, more than three times as many.
>
> That's not necessarily said. What those count are buffer *accesses*,
> *not* the number of distinct blocks accessed. You'll very commonly have
> more buffer accesses in indexscans but still fewer total reads because a
> lot of those accesses will be reads previously done in the same
> scan. Just imagine a scan of an index with a leaf page pointing to 100
> tuples of the same value - that'd result in at least a 100 buffer
> accesses, but it'd be highly likely that they'll be in cache.

Thanks for explaining that.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message legrand legrand 2017-11-29 20:17:19 Partition pruning / agg push down for star schema in pg v11
Previous Message Rory Campbell-Lange 2017-11-29 19:37:04 Re: large numbers of inserts out of memory strategy