PV wrote:
> Any suggestion?
You provided too little information to suggest much beyond using JOIN
instead of a subquery. Something like:
SELECT pr.id, pr.catid, cat.a, cat.b
FROM pr join cat ON (cat.id = pr.catid)
WHERE "lft" > 1 AND "rgt" < 10 AND (...)
ORDER BY cat.id
OFFSET 0 LIMIT 40;
We can provide more specific suggestions if you follow the advice
here:
http://wiki.postgresql.org/wiki/SlowQueryQuestions
And please format your queries to make them more readable --
something like I did above.
-Kevin