From: | Oleg Broytmann <phd(at)sun(dot)med(dot)ru> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] Bug on complex subselect (was: Bug on complex join) |
Date: | 1999-03-10 09:33:34 |
Message-ID: | Pine.SOL2.3.96.SK.990310122622.6331A-100000@sun.med.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello!
I rewrote my 4-tables join to use subselects:
SELECT DISTINCT subsec_id FROM positions
WHERE pos_id IN
(SELECT DISTINCT pos_id
FROM central
WHERE shop_id IN
(SELECT shop_id FROM shops
WHERE distr_id IN
(SELECT distr_id FROM districts
WHERE city_id = 2)
)
)
;
This does not work, either - postgres loops forever, until I cancel
psql.
I splitted it - I ran
(SELECT DISTINCT pos_id
FROM central
WHERE shop_id IN
(SELECT shop_id FROM shops
WHERE distr_id IN
(SELECT distr_id FROM districts
WHERE city_id = 2)
)
)
and stored result in a file. Then I substituted the subselect with the
file:
SELECT DISTINCT subsec_id FROM positions
WHERE pos_id IN
(1, 2, 3, 6, 22, 25, 26, 27, 28, 29, 31, 33, 34, 35, 38, 41, 42, 44, 45,
46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64)
and got desired result within a second.
This finally solves my problem, but I need to pass a long way to find
that postgres cannot handle such not too complex joins and subselects.
Oleg.
----
Oleg Broytmann http://members.xoom.com/phd2/ phd2(at)earthling(dot)net
Programmers don't die, they just GOSUB without RETURN.
From | Date | Subject | |
---|---|---|---|
Next Message | David O'Farrell | 1999-03-10 09:57:23 | pg_dump and large objects ,sunos 5.6 , SC4.2 |
Previous Message | Jan Wieck | 1999-03-10 09:13:17 | Re: [HACKERS] Developers globe |