Skip site navigation (1) Skip section navigation (2)

Re: Query slow as Function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
Cc: Steve Horn <steve(at)stevehorn(dot)cc>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query slow as Function
Date: 2012-02-18 16:37:22
Message-ID: 27854.1329583042@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Andreas Kretschmer <akretschmer(at)spamfence(dot)net> writes:
> You can check the plan with the auto_explain - Extension, and you can
> force the planner to create a plan based on the actual input-value by
> using dynamic SQL (EXECUTE 'your query string' inside the function)

Steve *is* using EXECUTE, so that doesn't seem to be the answer.  I'm
wondering about datatype mismatches myself --- the function form is
forcing the parameter to be char(9), which is not a constraint imposed
in the written-out query.  There are lots of other possibilities
though.  It would be hard to say much without a self-contained example
to try.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Andrew DunstanDate: 2012-02-18 16:41:18
Subject: Re: Query slow as Function
Previous:From: Andreas KretschmerDate: 2012-02-18 16:02:44
Subject: Re: Query slow as Function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group