Re: Matching several rows

From: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: Ivan Steganov <istegan6(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Matching several rows
Date: 2006-01-18 12:48:34
Message-ID: 20060118124834.GC578@alamut
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2006-01-18 12:59:03 Re: Matching several rows
Previous Message Michael Glaesemann 2006-01-18 12:33:20 Re: Matching several rows