It is easier to think of this as SET INTERSECTION which leads to:
SELECT id FROM urights WHERE right = 2
INTERSECT
SELECT id FROM urights WHERE right = 5
INTERSECT
SELECT id FROM urights WHERE right = 10
Ivan Steganov wrote:
Thank you to everyone for the great help!
I will evaluate all methods
Michael Glaesemann wrote:
On Jan 18, 2006, at 21:48 , Volkan YAZICI wrote:
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.
explain an
Thank you to everyone for the great help!I will evaluate all methods in our query (It is actually well complexer then this sample) and choose the best one.Is there any "scientific" name to this kind of "several rows match for one result" data selection?
Ivan
On Jan 18, 2006, at 21:48 , Volkan YAZICI wrote:
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.
explain analyze
SELECT id
FROM (
SE
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
On Jan 18, 2006, at 20:55 , Volkan YAZICI wrote:
On Jan 18 05:43, Ivan Steganov wrote:
IDRIGHT
-
201
202
205
2010
302
3010
Now I need to find out which IDs have, say rights 2 AND 5 AND 10.
SELECT t.id
FROM (SELECT i
Hi,
On Jan 18 05:43, Ivan Steganov wrote:
> IDRIGHT
> -
> 201
> 202
> 205
> 2010
> 302
> 3010
>
> Now I need to find out which IDs have, say rights 2 AND 5 AND 10.
SELECT t.id
FROM (SELECT id, sum(1) AS s
FROM
On Jan 18, 2006, at 13:43 , Ivan Steganov wrote:
A table URIGHTS which stores an ID and the RIGHTs this ID has. One
ID may have many rights and accordingly records in table, sample:
Now I need to find out which IDs have, say rights 2 AND 5 AND 10.
select "ID"
from "URIGHTS" as right_2
joi
Hi,This is possibly absolutely trivial but I am lost...A table URIGHTS which stores an ID and the RIGHTs this ID has. One ID may have many rights and accordingly records in table, sample:ID RIGHT
-20 120 220 520 1030 230 10Now I n