pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: PostgreSQL Performance List <pgsql-performance@postgresql.org>
Subject: PostgreSQL underestimates sorting
Date: Wed, 22 Nov 2006 11:17:23 +0100
Message-ID: <456423B3.7010505@logix-tt.com> (raw)

Hi,

PostgreSQL 8.1 (and, back then, 7.4) have the tendency to underestimate
the costs of sort operations, compared to index scans.

The Backend allocates gigs of memory (we've set sort_mem to 1 gig), and
then starts spilling out more Gigs of temporary data to the disk. So the
execution gets - in the end - much slower compared to an index scan, and
wastes lots of disk space.

We did not manage to tune the config values appropriately, at least not
without causing other query plans to suffer badly.

Are there some nice ideas how to shift the planners preferences slightly
towards index scans, without affecting other queries?

There's one thing that most of those queries have in common: They
include TOAST data (large strings, PostGIS geometries etc.), and I
remember that there are known problems with estimating the TOAST costs.
This may be part of the problem, or may be irrelevant.


Thanks,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



view thread (6+ messages)  latest in thread

Message-ID: <456423B3.7010505@logix-tt.com>
Permalink:  ../456423B3.7010505@logix-tt.com/
Also on:    postgresql.org/message-id/456423B3.7010505@logix-tt.com

 · 

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: schabi@logix-tt.com
  Subject: Re: PostgreSQL underestimates sorting
  In-Reply-To: <456423B3.7010505@logix-tt.com>

* 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