Re: planner issue with constraint exclusion - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: planner issue with constraint exclusion
Date
Msg-id 20081215204647.GE26233@tamriel.snowman.net
Whole thread Raw
In response to Re: planner issue with constraint exclusion  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
* Joshua D. Drake (jd@commandprompt.com) wrote:
> On Mon, 2008-12-15 at 14:28 -0500, Tom Lane wrote:
> > "Joshua D. Drake" <jd@commandprompt.com> writes:
> > > Of the functions the only one that will use constraint_exclusion is the
> > > one that explicitly passes the date value.
> >
> > Since you haven't shown us the constraints you're talking about, or the
> > resulting plans, it's difficult for anyone to guess what's going on.
>
> I am not sure which plans I should show you as they are function plans
> thereby not very useful.

Ideally, do a 'raise notice' with the exact string you're passing to
EXECUTE, and then run an explain on that.  Constraint Exclusion
certainly does work when using explain and constants in general.  Have
you tried adding an explicit cast, ala:

EXECUTE 'SELECT l.unit_id FROM foo_stats_day lsd, foo51 l WHERE lsd.a_serv_id = l.unit_id AND lsd.a_serv_id = 1 AND day
=''' || temp || '''::date'; 
Enjoy,
    Stephen

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: SQL/MED compatible connection manager
Next
From: Josh Berkus
Date:
Subject: Re: Sync Rep: First Thoughts on Code