pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrzej Zawadzki <zawadaa@wp.pl>
To: pgsql-performance@postgresql.org
Subject: Poor performance with queries using clause: sth IN (...)
Date: Wed, 09 May 2007 15:22:41 +0200
Message-ID: <4641CB21.2010608@wp.pl> (raw)

That's email from my friend.
Any hint?

-------- Original Message --------
Subject: bug
Date: Wed, 09 May 2007 15:03:00 +0200
From: Michal Postupalski
To: Andrzej Zawadzki

We've just changed our database from 8.1 to 8.2 and we are
grief-stricken about very poor performance with queries using clause:
"sth IN (...)". As we can see any query is translate to "sth = ANY
('{....}'::bpchar[]))" and it tooks much more time beacuse it doesn't
use index'es. Why ? How can we speed up these queries? I've just read
"Performance of IN (...) vs. = ANY array[...]" on pgsql-performance
mailing list and I didn't find any solutions. Can anybody tell me what
can I do with postgres to force him using indexes? If there isn't any
solution I'm afraid that we will have to do downgrade to previous
version 8.1.

example:
SELECT count(*)
FROM kredytob b, kredyty k
WHERE true
AND b.kredytid = k.id
AND '' IN ('', upper(b.nazwisko))
AND '' IN ('', upper(b.imie))
AND '78111104485' IN ('', b.pesel)
AND '' IN ('', upper(trim(b.dowseria))) AND '' IN ('', b.dowosnr) AND 0
IN (0, b.typkred) AND k.datazwrot IS NULL;

regards...
MichaƂ Postupalski




view thread (2+ messages)  latest in thread

Message-ID: <4641CB21.2010608@wp.pl>
Permalink:  ../4641CB21.2010608@wp.pl/
Also on:    postgresql.org/message-id/4641CB21.2010608@wp.pl

 · 

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: zawadaa@wp.pl
  Subject: Re: Poor performance with queries using clause: sth IN (...)
  In-Reply-To: <4641CB21.2010608@wp.pl>

* 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