pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Hardman <peter@ssbg.zetnet.co.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-performance@postgresql.org
Subject: Re: PostgreSQL runs a query much slower than BDE and MySQL
Date: Thu, 17 Aug 2006 21:13:11 +0100
Message-ID: <44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk> (raw)
In-Reply-To: <18261.1155839607@sss.pgh.pa.us>
References: <5321.1155820310@sss.pgh.pa.us>

On 17 Aug 2006 at 14:33, Tom Lane wrote:

> I wrote:
> > Anywy, your point about the sort being redundant is a good one, and
> > offhand I'd have expected PG to catch that; I'll have to look into
> > why it didn't.  But that's not going to explain a 10x speed
> > difference, because the sort isn't 90% of the runtime.
> 
> I dug into this using some made-up test data, and was able to reproduce
> the plan you got after changing the order of the pkey index columns
> to (regn_no, transfer_date, flock_no) ... are you sure you quoted that
> accurately before?

Yes. Maybe the data I've uploaded to www.shetland-
sheep.org.uk/pgdata/sheep_flock.zip will help reproduce the plan.

<snip> 
> I found a couple of minor planner problems, which I've repaired in CVS
> HEAD.  You might consider using TEXT columns instead of VARCHAR(n),
> because the only bug that actually seemed to change the chosen plan
> involved the planner getting confused by the difference between
> varchar_var and varchar_var::text (which is what gets generated for
> sorting purposes because varchar doesn't have a separate sort operator).

As someone else suggested, these fields ought really to be CHAR no VARCHAR. 
I chose VARCHAR because the data mostly is shorter than the maximum lengths 
(although probably not enough to matter). I'd not really got into the subtleties of 
different behaviour of CHAR and VARCHAR.
> 
<snip> 

Regards,-- 
Peter Hardman
Acre Cottage, Horsebridge
King's Somborne
Stockbridge
SO20 6PT

== Breeder of Shetland Cattle and Shetland Sheep ==




view thread (22+ messages)  latest in thread

Message-ID: <44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk>
Permalink:  ../44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk/
Also on:    postgresql.org/message-id/44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: peter@ssbg.zetnet.co.uk, tgl@sss.pgh.pa.us
  Subject: Re: PostgreSQL runs a query much slower than BDE and MySQL
  In-Reply-To: <44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk>
  References: <5321.1155820310@sss.pgh.pa.us> <44E4DBE7.22131.10181D0@peter.ssbg.zetnet.co.uk>

* 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