From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ioannis Anagnostopoulos <ioannis(at)anatec(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Partitions are not excluded in stored procedures |
Date: | 2012-06-05 16:55:55 |
Message-ID: | 3479.1338915355@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Ioannis Anagnostopoulos <ioannis(at)anatec(dot)com> writes:
> I came across the following problem. Say I have a select query that
> given the appropriate where clauses it will only query the correct
> partitioned tables and not all of them. That can be examined by using
> the EXPLAIN. However the same select query used in a stored procedure
> will transverse all the tables regardless of the where clause parameters
> passed by the user as variables of the stored procedure . Is there any
> work around other than composing an EXECUTE "select ....."?
Yeah, if the WHERE clauses that correspond to the partitioning
constraints contain parameters, the planner can't prove the exclusions
hold. So you have to use EXECUTE to get a one-shot plan. This will
be better in 9.2 (which, basically, will automatically recognize that
it needs to use one-shot plans).
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-06-05 17:04:01 | Re: Why would Postgres not show in my data connections? |
Previous Message | Della-Croce, Gregory | 2012-06-05 16:14:42 | Why would Postgres not show in my data connections? |