Are there significant performance issues when using nested(2 level deep at max) queries in PostgreSQL? I use version 8.4.2
I am asking because I am planning to use quite a lot of those soon on a busy website..
Are there significant performance issues when using nested(2 level deep at max) queries in PostgreSQL? I use version 8.4.2
I am asking because I am planning to use quite a lot of those soon on a busy website..
Not really.
If you want to improve, does not forget to runs analyze on all tables periodically.
Your question is waaaaaaaaaaaaaaaaaaaaaaay too general. There isn't any inherent issue with using "nested" queries in Postgres, no matter how many levels deep. You need to post specific queries if you have issues.
Additionally...if you're designing a new system, then why 8.4 and not 9.0? And even on 8.4, you should update to 8.4.5.
The boring answer: it depends on the query and your data.
To write (and read and understand) a nested query might be easier than writing a non-nested one, but you might end up paying the price in reduced performance. During my previous database project we ended up rewriting quite a few of the more critical queries to avoid nesting and we saw order of magnitude performance improvements.
EXPLAIN is your friend. You should learn to love it and how to use it :) http://www.postgresql.org/docs/current/static/sql-explain.html