pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Davor J. <DavorJ@live.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: queries with subquery constraints on partitioned tables not optimized?
Date: Tue, 02 Feb 2010 19:14:14 -0500
Message-ID: <5002.1265156054@sss.pgh.pa.us> (raw)
In-Reply-To: <hk8sd1$2b79$1@news.hub.org>
References: <hk8sd1$2b79$1@news.hub.org>

"Davor J." <DavorJ@live.com> 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



view thread (4+ messages)  latest in thread

Message-ID: <5002.1265156054@sss.pgh.pa.us>
Permalink:  ../5002.1265156054@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5002.1265156054@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, DavorJ@live.com
  Subject: Re: queries with subquery constraints on partitioned tables not optimized?
  In-Reply-To: <5002.1265156054@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox