pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Phuong Ma <pma@commandprompt.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] performance inconsistency
Date: Wed, 04 Apr 2001 18:47:01 -0400
Message-ID: <12879.986424421@sss.pgh.pa.us> (raw)
In-Reply-To: <3ACB9C4B.1071C2F1@commandprompt.com>
References: <3ACB9C4B.1071C2F1@commandprompt.com>

Phuong Ma <pma@commandprompt.com> writes:
> WHERE substr("ORDER_NUM", 1, 1) != 'W'; # (Orders NOT prefixed with W.)

> OR...

> WHERE substr("ORDER_NUM", 1, 1) = 'I';  # (Orders prefixed with I.)

> However, the first query runs in about 10-15 seconds, and the second
> query
> ran for over 40 minutes before I cancelled it.

What query plans does EXPLAIN show for each case?  (And have you done
VACUUM ANALYZE lately?)

The change in the WHERE clause may be altering the planner's selectivity
guesstimates enough to cause choice of a less appropriate plan.  Hard to
tell without seeing what EXPLAIN has to say, though.

			regards, tom lane



view thread (2+ messages)

Message-ID: <12879.986424421@sss.pgh.pa.us>
Permalink:  ../12879.986424421@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12879.986424421@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 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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pma@commandprompt.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] performance inconsistency
  In-Reply-To: <12879.986424421@sss.pgh.pa.us>
  References: <3ACB9C4B.1071C2F1@commandprompt.com> <12879.986424421@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