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

ECPG failed and Postmaster getting bigger in using perl Pg

From: "S(dot)F(dot) Lee" <sflee_tw(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: ECPG failed and Postmaster getting bigger in using perl Pg
Date: 2000-05-10 02:21:57
Message-ID: 20000510022157.4467.qmail@web213.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Hi everyone,  

  I am revamping a computer system by Red Hat 6.0 +
PostgreSQL 6.5.3 + ecpg 2.7 + C. The user interface is
perl Pg + Apache. Everything seems fine, but when I 
use "top" to display long term CPU processes, I find
the postmaster is getting bigger in step of 4 kb and 
performance is getting worse GRADUALLY (It seems that 
perl + Pg would make the size expansion more quickly 
than ECPG). Here are some data display in "top": 

 PID    SIZE    RSS    SHARE    TIME    COMMAND
2526    1260   1260     1040    0:00    postmaster  --
when postmaster started
2526   28384    20M      388    4:41    postmaster  --
2 days later

  I didn't find any error in tracing my program, and
the child postmaster is terminated correctly. I really
can't figure out the reason. Please give me advise. 

  I have installed the latest version 7.0RC5, but I
find my C program fails in ECPG 2.7 although it works
fine in PostgreSQL 6.5.3, Postmaster is getting bigger
too (perl + Pg), Here is a simple example:

1. I create a table foo_1 and insert 2 rows of data:
    CREATE TABLE foo_1
    (
        recno      int  PRIMARY KEY,  -- PRIMARY KEY
        a1         int,
        b1         float,
        spare      int
    );
    insert into foo_1 values(1,10,11.1,0);
    insert into foo_1 values(2,20,22.2,0);

2. I write a program (Test.pgc) to get a whole row
into a structure temp by "select *":

/*
exec sql whenever sqlerror sqlprint;
*/
exec sql include sqlca;
#include        <string.h>
#include        <stdlib.h>
#include        <unistd.h>
#include        <stdio.h>
#include        <errno.h>

main()
{
   exec sql begin declare section;
      struct data
      {	
              
	 int           recno;
         int           a1;
         float         b1;
         int           spare;

      } temp;
      int PK_INDEX;
   exec sql end declare section;

   exec sql connect to by2db;
   if (sqlca.sqlcode != 0)
   {
      printf ("connect database error =
%s\n",sqlca.sqlerrm.sqlerrmc);
      exit (-1);
   }

   PK_INDEX = 1;
   exec sql select * into :temp from foo_1 where recno
= :PK_INDEX;
   if (sqlca.sqlcode != 0)
   {
      printf ("sql_select--foo_1 :
%s\n",sqlca.sqlerrm.sqlerrmc);
      exit (-1);
   }
   printf (" a1 = %d b1 = %f\n",temp.a1,temp.b1);

   exec sql disconnect all;
   exit(0);
}
  
After executing program(Test), I got different result
in each version of PostgreSQL, 
such as:

   In PostgreSQL 6.5.3 + ecpg 2.7 : a1 = 10 b1 =
11.100000   

   In PostgreSQL 7.0RC5 + ecpg 2.7 : sql_select--foo_1
: Too few arguments in line 33.

I would REALLY appreciate some suggestions.

   Thanks
               S.F.Lee

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Responses

pgsql-interfaces by date

Next:From: Thomas LockhartDate: 2000-05-10 05:33:21
Subject: Re: looking for doc for ecpg
Previous:From: Tom LaneDate: 2000-05-09 17:42:37
Subject: Re: Can functions return NULL value?

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