pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-performance@postgresql.org
Subject: Re: hash aggregation
Date: Fri, 12 Oct 2012 23:14:35 +0200
Message-ID: <5078883B.5000509@fuzzy.cz> (raw)
In-Reply-To: <CAL_0b1trANSSN2f3AhWGc1+DG96D2ig-n-ZEv3kLsvAiwNr2aA@mail.gmail.com>
References: <118871349885342@web16f.yandex.ru>
	<CAL_0b1tHHHGz=umGWm=FXkSkt+yCJh-Cb10BJLoD-i3mwvNeaQ@mail.gmail.com>
	<323831349928808@web5g.yandex.ru>
	<50764D55.2060401@ringerc.id.au>
	<53981349968513@web6f.yandex.ru>
	<CAL_0b1tap1pSQ78t482ynYN_2yBqpYQnmJAXNC3zS023+=Xqqg@mail.gmail.com>
	<246351350014151@web25e.yandex.ru>
	<CAL_0b1v1yGzkLsnCS=8Cxh8awPa22F5OZYM4NcpvpYijFcABLA@mail.gmail.com>
	<270381350015278@web27h.yandex.ru>
	<CAL_0b1trANSSN2f3AhWGc1+DG96D2ig-n-ZEv3kLsvAiwNr2aA@mail.gmail.com>

On 12.10.2012 09:10, Sergey Konoplev wrote:
> What I can not understand is why the seq scan's estimated cost is
> better the index scan's one. It depends on the number of pages in
> index/relation. May be the index is heavily bloated?

The IOS cost depends on other things too. The index can't be read simply
as a sequence of pages, the scan needs to jump around the tree to read
the tuples in the right order.

With the index size being close to the size of the table, the cost of
these operations may easily outweight the benefits. And I suspect this
is the case here, because the table has only 3 columns (INT and two text
ones), and each row has some overhead (header), that may further
decrease the difference between index and table size.

Nevertheless, the cost estimate here is wrong - either it's estimating
something wrong, or maybe everything is in the case and the planner does
not know about that.

Tomas




view thread (15+ messages)  latest in thread

Message-ID: <5078883B.5000509@fuzzy.cz>
Permalink:  ../5078883B.5000509@fuzzy.cz/
Also on:    postgresql.org/message-id/5078883B.5000509@fuzzy.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tv@fuzzy.cz
  Subject: Re: hash aggregation
  In-Reply-To: <5078883B.5000509@fuzzy.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox