pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Scott Carey <scott@richrelevance.com>
Cc: Moritz Onken <onken@houseofdesign.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: Slow query with a lot of data
Date: Wed, 20 Aug 2008 14:28:18 -0400
Message-ID: <3232.1219256898@sss.pgh.pa.us> (raw)
In-Reply-To: <a1ec7d000808201106j4e901d42q3a296ca1d84c2f9c@mail.gmail.com>
References: <90AA1B69-4E9C-4710-9D58-F65620DDA022@houseofdesign.de>
	<8EF0BB61-D8FE-47E8-97DD-1009F7EB5431@houseofdesign.de>
	<alpine.DEB.1.10.0808181550110.4454@aragorn.flymine.org>
	<0BFF9855-F1FA-4A83-B8B2-622D7CE69F77@houseofdesign.de>
	<alpine.DEB.1.10.0808181657350.4454@aragorn.flymine.org>
	<3663375B-7AC0-43F6-B6EC-D3EE572F3D34@houseofdesign.de>
	<alpine.DEB.1.10.0808191202450.4454@aragorn.flymine.org>
	<24E3FBFF-E0B8-435E-ACE1-652E93FE2213@houseofdesign.de>
	<alpine.DEB.1.10.0808191311540.4454@aragorn.flymine.org>
	<380CD097-4A33-4134-8C13-B9BF34EC6C63@houseofdesign.de>
	<a1ec7d000808201106j4e901d42q3a296ca1d84c2f9c@mail.gmail.com>

"Scott Carey" <scott@richrelevance.com> writes:
> The planner actually thinks there will only be 28704 rows returned of width
> 12.  But it chooses to sort 53 million rows before aggregating.  Thats
> either a bug or there's something else wrong here.   That is the wrong way
> to aggregate those results no matter how much work_mem you have unless I'm
> completely missing something...

That does look weird.  What are the datatypes of the columns being
grouped by?  Maybe they're not hashable?

Another forcing function that prevents use of HashAgg is DISTINCT
aggregates, but you don't seem to have any in this query...

			regards, tom lane



view thread (26+ messages)  latest in thread

Message-ID: <3232.1219256898@sss.pgh.pa.us>
Permalink:  ../3232.1219256898@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3232.1219256898@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, scott@richrelevance.com, onken@houseofdesign.de
  Subject: Re: Slow query with a lot of data
  In-Reply-To: <3232.1219256898@sss.pgh.pa.us>

* 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