X-Original-To: pgsql-interfaces@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 5444A924D88 for ; Wed, 28 May 2003 03:00:24 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 30983-06 for ; Wed, 28 May 2003 03:00:21 -0400 (EDT) Received: from hotmail.com (dav34.sea1.hotmail.com [207.68.162.91]) by developer.postgresql.org (Postfix) with ESMTP id 0A8A1924DC8 for ; Wed, 28 May 2003 03:00:21 -0400 (EDT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 28 May 2003 00:00:20 -0700 Received: from 80.196.20.130 by dav34.sea1.hotmail.com with DAV; Wed, 28 May 2003 07:00:20 +0000 X-Originating-IP: [80.196.20.130] X-Originating-Email: [bts_postgresql@hotmail.com] From: "BTS" To: Subject: Re: [Fwd: PREPARE in ECPG] Date: Wed, 28 May 2003 09:00:19 +0200 Organization: BTS Solutions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00BD_01C324F7.904440A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: X-OriginalArrivalTime: 28 May 2003 07:00:20.0612 (UTC) FILETIME=[CD8C7C40:01C324E6] X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/82 X-Sequence-Number: 4200 This is a multi-part message in MIME format. ------=_NextPart_000_00BD_01C324F7.904440A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Our application consists of several programs with one major running in online mode. In online mode we start typically 40 to 60 incarnations of this program, and it runs for months (until the machine is rebooted). Therefor the effect on an efficient PREPARE/EXECUTE will be significant. We know the importance of this from running our application under Informix, because there we use the efficient PREPARE/EXECUTE. We look forward for the ECPG implementation of PREPARE plan_name [ (datatype [, ...] ) ] AS query and EXECUTE plan_name [ (parameter [, ...] ) ] INTO... We hope to be able to write statements like: EXEC SQL PREPARE stm (char(5), int) as SELECT a,b,c INTO :host_a, :host_b, :host_c FROM mytable WHERE d=3D$1 AND e=3D$2; ... EXEC SQL EXECUTE stm (:host_d, :host_e); or EXEC SQL PREPARE stm (char(5), int) as SELECT a,b,c FROM mytable WHERE d=3D$1 AND e=3D$2; ... EXEC SQL EXECUTE stm (:host_d, :host_e) INTO :host_a, :host_b, :host_c; Best Regards Bo Tveden Mads Madsen BTS Solutions ----- Original Message -----=20 From: "Bruce Momjian" To: "Paul Tilles" Cc: Sent: Friday, May 23, 2003 5:55 PM Subject: Re: [Fwd: [INTERFACES] PREPARE in ECPG] > > As far as Informix, we do have PREPARE/EXECUTE in 7.3, and 7.4, due out > in a few months, will have several Informix-specific improvments, like > better ecpg support (and hance better 4GL support via Aubit 4GL), plus > SQL improvements like WHERE CURRENT OF and WITH HOLD cursors. > > -------------------------------------------------------------------------- - > > Paul Tilles wrote: > > > > > > Paul Tilles wrote: > > > > > Your posting is very interesting! We are looking at porting our > > > Informix applications to PostgreSQL due to the increased cost of > > > licenses. > > > > > > I had read in the documentation that PREPARE/EXECUTE is available in > > > Version 7.3. If this is not the case, we would not be able to port > > > our applications to PostgreSQL. > > > > > > BTW, what version of ecpg do you have (I have version 2.80)? > > > > > > Can anybody out there in PostgreSQL-land please comment on this? > > > > > > Thanks. > > > > > > Paul Tilles > > > > > > BTS wrote: > > > > > >> We have a large application written in C language (not C++) using > > >> embedded SQL. The number of tables in the database is about 60, with > > >> about 80 SQL indexes. Total number of SQL statements is about 800 to > > >> 1000. All SQL statements are generated by a program generator > > >> handling the differences between Oracle/Informix/PostgreSQL. All > > >> SELECT statements are "simple", extracting data from only one table > > >> (no joins or similar). The application works under Oracle (using > > >> Pro-C preprocessor) and Informix (using ESQL preprocessor). Under > > >> PostgreSQL we use the ECPG preprocessor. FYI it took us only a few > > >> weeks to port the application to PostgreSQL. The application works > > >> under all these database systems and has been trimmed with the > > >> necessary SQL indexes etc. For the PostgreSQL we continually run the > > >> necessary VACUUM + ANALYZE to ensure the PostgreSQL optimizer uses > > >> the proper SQL indexes (there are no table scans). The documentation > > >> for PostgreSQL 7.3 explains about introducing the optimized > > >> PREPARE/EXECUTE statements, but we have discovered this is not > > >> implemented (yet) in ECPG (we are using release 7.3.2). See comments > > >> in "ecpg/preproc/preproc.y". We have a major installation currently > > >> using Oracle, but they want to switch to PostgreSQL when the access > > >> time reaches a reasonable level. The size of database (tables + > > >> indexes) is about 120 GB, and the number of SELECTs from the tables > > >> is of the magnitude 200 to 500 million per day, split over a number > > >> of SUN E10K machines (about 30 processors each with 1 GB RAM). (The > > >> Oracle license and annual maintenance fee on this setup are > > >> exorbitant!!) Without the optimized PREPARE/EXECUTE we see a SELECT > > >> time of about 30 milliseconds (measured on the SUN E10K) of which > > >> most seems to be CPU time spent inside postmaster. The similar time > > >> from Oracle is about 1 to 5 milliseconds on the same hardware. Both > > >> PostgreSQL and Oracle have been setup with a cache (shared_buffers) > > >> of 120000. To our customer the 30 milliseconds are not acceptable. > > >> Based on the PostgreSQL 7.3 documentation we should expect "improved > > >> performance" when using prepared queries. This leads to a couple of > > >> questions regarding the optimized PREPARE/EXECUTE: - Do you have any > > >> indication of the performance improvement (measured in percentage)? > > >> - When will the optimized PREPARE/EXECUTE be implemented in ECPG? > > >> Best Regards > > >> Bo Tveden > > >> Mads Madsen > > >> BTS Solutions > > > > > --=20 > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 359-1001 > + If your life is a hard drive, | 13 Roberts Road > + Christ can be your backup. | Newtown Square, Pennsylvania 19073 > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > ------=_NextPart_000_00BD_01C324F7.904440A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Ou= r application=20 consists of several programs with one major running in
online mode. In o= nline=20 mode we start typically 40 to 60 incarnations of this
program, and it ru= ns=20 for months (until the machine is rebooted). Therefor
the effect on an=20 efficient PREPARE/EXECUTE will be significant.

We know the importanc= e of=20 this from running our application under Informix,
because there we use t= he=20 efficient PREPARE/EXECUTE.

We look forward for the ECPG implementati= on=20 of
  PREPARE plan_name [ (datatype [, ...] ) ] AS query
and
&= nbsp;=20 EXECUTE plan_name [ (parameter [, ...] ) ] INTO...

We hope to be abl= e to=20 write statements like:
  EXEC SQL
    PREPARE stm= =20 (char(5), int) as SELECT a,b,c INTO :host_a,=20 :host_b,
:host_c
        &nbs= p;            &= nbsp;           =20 FROM mytable WHERE d=3D$1 AND e=3D$2;
...
  EXEC=20 SQL
    EXECUTE stm (:host_d,=20 :host_e);

or

  EXEC SQL
    PREPARE st= m=20 (char(5), int) as SELECT a,b,c FROM mytable WHERE d=3D$1=20 AND
e=3D$2;
...
  EXEC SQL
    EXECUTE stm= =20 (:host_d, :host_e) INTO :host_a, :host_b, :host_c;


Best Regards<= BR>Bo=20 Tveden
Mads Madsen
BTS Solutions

----- Original Message -----= =20
From: "Bruce Momjian" <
pgman@candle.pha.pa.us>
To: "Paul Tilles" <
Paul.Tilles@noaa.gov>
Cc: <
pgsql-interfaces@postgresql.org>
Sent: Friday, May 23, 2003 5:55 PM
Subject: Re: [Fwd:= =20 [INTERFACES] PREPARE in ECPG]


>
> As far as Informix, w= e do=20 have PREPARE/EXECUTE in 7.3, and 7.4, due out
> in a few months, will= have=20 several Informix-specific improvments, like
> better ecpg support (an= d=20 hance better 4GL support via Aubit 4GL), plus
> SQL improvements like= =20 WHERE CURRENT OF and WITH HOLD cursors.
>
>=20 --------------------------------------------------------------------------<= BR>-
>
>=20 Paul Tilles wrote:
> >
> >
> > Paul Tilles=20 wrote:
> >
> > > Your posting is very=20 interesting!   We are looking at porting our
> > >=20 Informix applications to PostgreSQL due to the increased cost of
> &g= t;=20 > licenses.
> > >
> > > I had read in the=20 documentation that PREPARE/EXECUTE is available in
> > > Versio= n=20 7.3.  If this is not the case, we would not be able to port
> &g= t;=20 > our applications to PostgreSQL.
> > >
> > > BT= W,=20 what version of ecpg do you have (I have version 2.80)?
> >=20 >
> > > Can anybody out there in PostgreSQL-land please comm= ent=20 on this?
> > >
> > > Thanks.
> > >
&= gt;=20 > > Paul Tilles
> > >
> > > BTS wrote:
>= ;=20 > >
> > >> We have a large application written in C=20 language (not C++) using
> > >> embedded SQL. The number of= =20 tables in the database is about 60, with
> > >> about 80 SQL= =20 indexes. Total number of SQL statements is about 800 to
> > >&g= t;=20 1000. All SQL statements are generated by a program generator
> >= =20 >> handling the differences between Oracle/Informix/PostgreSQL.=20 All
> > >> SELECT statements are "simple", extracting data f= rom=20 only one table
> > >> (no joins or similar). The application= =20 works under Oracle (using
> > >> Pro-C preprocessor) and Inf= ormix=20 (using ESQL preprocessor). Under
> > >> PostgreSQL we use th= e=20 ECPG preprocessor. FYI it took us only a few
> > >> weeks to= port=20 the application to PostgreSQL. The application works
> > >> = under=20 all these database systems and has been trimmed with the
> > >&= gt;=20 necessary SQL indexes etc. For the PostgreSQL we continually run the
>= ;=20 > >> necessary VACUUM + ANALYZE to ensure the PostgreSQL optimizer= =20 uses
> > >> the proper SQL indexes (there are no table scans= ).=20 The documentation
> > >> for PostgreSQL 7.3 explains about= =20 introducing the optimized
> > >> PREPARE/EXECUTE statements,= but=20 we have discovered this is not
> > >> implemented (yet) in E= CPG=20 (we are using release 7.3.2). See comments
> > >> in=20 "ecpg/preproc/preproc.y". We have a major installation currently
> &g= t;=20 >> using Oracle, but they want to switch to PostgreSQL when the=20 access
> > >> time reaches a reasonable level. The size of= =20 database (tables +
> > >> indexes) is about 120 GB, and the= =20 number of SELECTs from the tables
> > >> is of the magnitude= 200=20 to 500 million per day, split over a number
> > >> of SUN E1= 0K=20 machines (about 30 processors each with 1 GB RAM). (The
> > >&g= t;=20 Oracle license and annual maintenance fee on this setup are
> >=20 >> exorbitant!!) Without the optimized PREPARE/EXECUTE we see a=20 SELECT
> > >> time of about 30 milliseconds (measured on the= SUN=20 E10K) of which
> > >> most seems to be CPU time spent inside= =20 postmaster. The similar time
> > >> from Oracle is about 1 t= o 5=20 milliseconds on the same hardware. Both
> > >> PostgreSQL an= d=20 Oracle have been setup with a cache (shared_buffers)
> > >> = of=20 120000. To our customer the 30 milliseconds are not acceptable.
> >= ;=20 >> Based on the PostgreSQL 7.3 documentation we should expect=20 "improved
> > >> performance" when using prepared queries. T= his=20 leads to a couple of
> > >> questions regarding the optimize= d=20 PREPARE/EXECUTE: - Do you have any
> > >> indication of the= =20 performance improvement (measured in percentage)?
> > >> - W= hen=20 will the optimized PREPARE/EXECUTE be implemented in ECPG?
> > >= ;>=20 Best Regards
> > >> Bo Tveden
> > >> Mads=20 Madsen
> > >> BTS Solutions
> > >
>
>= ; --=20
>   Bruce=20 Momjian           &n= bsp;           =20 | 
http://candle.pha.pa.us
>   = pgman@candle.pha.pa.us
           =    =20 |  (610) 359-1001
>   +  If your life is a hard= =20 drive,     |  13 Roberts Road
>  = =20 +  Christ can be your backup.       = ;=20 |  Newtown Square, Pennsylvania
19073
>
>=20 ---------------------------(end of broadcast)--------------------------->=20 TIP 4: Don't 'kill -9' the=20 postmaster
>
------=_NextPart_000_00BD_01C324F7.904440A0--