"Davor J." <DavorJ@xxxxxxxx> writes: > Now, if one takes a subquery for "1", the optimizer evaluates it first > (let's say to "1"), but then searches for it (sequentially) in every > partition, which, for large partitions, can be very time-consuming and goes > beyond the point of partitioning. No, the optimizer doesn't "evaluate it first". Subqueries aren't ever assumed to reduce to constants. (If you actually do have a constant expression, why don't you just leave out the word SELECT?) regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance