From: | "veramente(at)libero(dot)it" <veramente(at)libero(dot)it> |
---|---|
To: | "pgsql-general" <pgsql-general(at)postgresql(dot)org> |
Subject: | Strange Slow query |
Date: | 2004-02-10 13:30:57 |
Message-ID: | HSVEVL$BAF19303921D8A9C1C516CA8AAB3E5DC@libero.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello all,
I have the following query that has a problem i cannot resolve:
SELECT puzzle_picking.*, tmagaztestate.mconto, tanagraficagen.araso, tmagaztestate.mdabol, tcausalimagaz.tdescr
FROM tcausalimagaz RIGHT JOIN (tanagraficagen RIGHT JOIN (tmagazrighe LEFT JOIN tmagaztestate ON (tmagazrighe.mnubol = tmagaztestate.mnubol) AND (tmagazrighe.mspecie = tmagaztestate.mspecie) AND (tmagazrighe.manno = tmagaztestate.manno) AND (tmagazrighe.mtiprk = tmagaztestate.mtiprk)) RIGHT JOIN puzzle_picking ON (tmagazrighe.mriga = puzzle_picking.pkriga) AND (tmagazrighe.mnubol = puzzle_picking.pknumbol) AND (tmagazrighe.mspecie = puzzle_picking.pkspecie) AND (tmagazrighe.manno = puzzle_picking.pkanno) ON tanagraficagen.aconto = tmagaztestate.mconto) ON tcausalimagaz.tcod = tmagazrighe.mcaus
WHERE (((puzzle_picking.pkartcode)='5320009'))
ORDER BY puzzle_picking.pkdate;
Basically it is very slow (20 secs to perform ), but if i change the right join of tanagraficagen to an inner join it is instant (< than a second). My question is:
Is it possible that a right join performs that much slower .. ? i mean i can undertsand it takes more time .. but 20 sec is far too much ..
What can i do to speed it up?? Keep in mind that i have indexes on all of the joined columns and on the column in the where clause ..
Thank you very much,
Fabrizio Mazzoni
Macron Srl
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Lester | 2004-02-10 14:03:44 | Re: Increasing Max Connections Mac OS 10.3 |
Previous Message | Bruno Wolff III | 2004-02-10 13:06:10 | Re: Analyze not doing anything? |