pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: Michael Glaesemann <grzm@myrealbox.com>
Cc: Ivan Steganov <istegan6@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Matching several rows
Date: Wed, 18 Jan 2006 14:48:34 +0200
Message-ID: <20060118124834.GC578@alamut> (raw)
In-Reply-To: <AC724692-16FC-4D58-9063-28E8745CE1BA@myrealbox.com>
References: <3578f52e0601172043s64561353i689350a1c5d4debb@mail.gmail.com>
	<20060118115517.GA578@alamut>
	<AC724692-16FC-4D58-9063-28E8745CE1BA@myrealbox.com>

On Jan 18 09:33, Michael Glaesemann wrote:
> On Jan 18, 2006, at 20:55 , Volkan YAZICI wrote:
> >SELECT t.id
> >FROM (SELECT id, sum(1) AS s
> >	  FROM id_n_rights
> >	  WHERE rights = ANY(ARRAY[2,5,10])
> >	  GROUP BY id) AS t
> >WHERE t.s = 3;

AFAICS, the bottleneck in above query is ANY(ARRAY[]) clause usage.
Instead of that, if you replace «rights = ANY(ARRAY[2,5,10])» with
«rights IN (2,5,10)» it's overhead decreases to 0.200-0.300ms domain.


Regards.



view thread (9+ messages)  latest in thread

Message-ID: <20060118124834.GC578@alamut>
Permalink:  ../20060118124834.GC578@alamut/
Also on:    postgresql.org/message-id/20060118124834.GC578@alamut

 · 

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-sql@postgresql.org
  Cc: yazicivo@ttnet.net.tr, grzm@myrealbox.com, istegan6@gmail.com
  Subject: Re: Matching several rows
  In-Reply-To: <20060118124834.GC578@alamut>

* 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