Re: Matching several rows - Mailing list pgsql-sql

From Volkan YAZICI
Subject Re: Matching several rows
Date
Msg-id 20060118124834.GC578@alamut
Whole thread Raw
In response to Re: Matching several rows  (Michael Glaesemann <grzm@myrealbox.com>)
Responses Re: Matching several rows  (Michael Glaesemann <grzm@myrealbox.com>)
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Daryl Richter
Date:
Subject: Re: bug with if ... then ... clause in views
Next
From: Michael Glaesemann
Date:
Subject: Re: Matching several rows