Execution plan caching

Started by Philippe Langover 18 years ago3 messagesgeneral
Jump to latest
#1Philippe Lang
philippe.lang@attiksystem.ch

Hi,

I have recently used the MS SQL Server 2005 database, and found out that
there is no mecanism where an execution plan can be reused between two
successive calls to a view. This is only true with stored procedures.

Is that also true with the Postgresql engine?

Philippe

#2Richard Huxton
dev@archonet.com
In reply to: Philippe Lang (#1)
Re: Execution plan caching

Philippe Lang wrote:

Hi,

I have recently used the MS SQL Server 2005 database, and found out that
there is no mecanism where an execution plan can be reused between two
successive calls to a view. This is only true with stored procedures.

Is that also true with the Postgresql engine?

Well, if you prepare "SELECT * FROM my_view" then the plan for that will
be cached. In general though, the query will be planned each time.

--
Richard Huxton
Archonet Ltd

#3Doug McNaught
doug@mcnaught.org
In reply to: Philippe Lang (#1)
Re: Execution plan caching

"Philippe Lang" <philippe.lang@attiksystem.ch> writes:

Hi,

I have recently used the MS SQL Server 2005 database, and found out that
there is no mecanism where an execution plan can be reused between two
successive calls to a view. This is only true with stored procedures.

Is that also true with the Postgresql engine?

To the best of my knowledgle, if you PREPARE a query that uses a view,
either explicitly or implicitly via your database driver, the plan
will be cached.

-Doug