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

Re: PREPARE/EXECUTE across backends?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jingren Zhou <jrzhoupro(at)hotmail(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PREPARE/EXECUTE across backends?
Date: 2003-10-02 02:10:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

On Wed, 1 Oct 2003, Jingren Zhou wrote:

> Hi,
> >From the document, it seems that PREPARE/EXECUTE works only in the same
> session. I am wondering whether postgres can prepare a query (save the plan)
> for difference backends.
> I am working on a project which requires executing "psql -c 'query'" in
> command line multiple times. Since the performance is critical, it would be
> nice to prepare the same query first to avoid being parsed/optimized each
> time. But psql opens a new backend each time, it looks like that
> PREPARE/EXECUTE doesn't work. Is there any workaround?

Your real overhead here isn't from having to prepare the query each time,
it's from having to start psql and open a new connection each time.
Perhaps you need to rethink your design and go with something that will
maintain a persistent connection.

Kris Jurka

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2003-10-02 02:43:46
Subject: Re: PREPARE/EXECUTE across backends?
Previous:From: Christopher Kings-LynneDate: 2003-10-02 01:44:49
Subject: Re: NOTICE: CREATE TABLE will create implicit triggers

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