plpgsql plan cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to make a select query in my plpgsql function to use an index allowing an index scan instead of a seq scan.

When running the query in the sql prompt, it works fine, but apparently the index is not used for the same query in the plpgsql function.

The problem is not the data types of the parameters to the function or the query, they are identical.

When I tried using EXECUTE in the plpgsql function, the index is being used.

I thought the query planner must have made a bad decision when I created the function the first time.

I therefore tried to drop the function, disconnect from the sql client, reconnect (to get a new session), create the function again.
The function still runs slow though.

I cannot understand why the index is not being used when in the plpgsql function? I even tried to make a test function containing nothing more than the single query. Still the index is not being used. When running the same query in the sql prompt, the index is in use though.

Is there a way to someone clear the entire query cache or even better for a particular plpgsql function?

I'm greatful for any ideas.

Best regards,

Joel Jacobson


--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux