Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id SAA18568 for postgres-redist; Thu, 24 Aug 1995 18:01:56 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199508250101.SAA18568@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from tristero.io.com (tristero.io.com [199.170.88.11]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id SAA24453 for <postgres@postgres.berkeley.edu>; Thu, 24 Aug 1995 18:01:54 -0700
Received: from dialup-78.austin.io.com (dialup-89.austin.io.com [199.170.89.127]) by tristero.io.com (8.6.12/8.6.12) with SMTP id UAA25313 for <postgres@postgres.berkeley.edu>; Thu, 24 Aug 1995 20:01:26 -0500
Date: Thu, 24 Aug 1995 20:01:26 -0500
Message-Id: <199508250101.UAA25313@tristero.io.com>
X-Sender: mskc@mail.io.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: postgres@postgres.Berkeley.EDU
From: mskc@io.com (Casey Claiborne)
Subject: Slow Postgres performance
X-Mailer: <PC Eudora Version 1.4>
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Thu, 24 Aug 95 18:01:56 -0700
Resent-XMts: smtp

Hello -
        I had downloaded postgres and am using it on a 486 SX 33Mhz machine
under the Linux 1.2.1 operating system. I am making calls to the postgres
server from "C" code (I am using embedded sql). I have routines such as
db_add_user_info, db_get_user_info, db_delete_user info which are written
very much similar to the one below with the exception that some of the code
and the queries themselves will change. Whenever I run my application using the 
routines the performance is VERY slow. I have not yet added indexes - I do 
not know
if that alone will solve the problem. Is there a *better approach* I can use?

*Any* help is welcomed and appreciated.

TIA

Casey


========================= code starts below ================================

My routines look something like the following:

[other code]

typedef user struct_user {
char name[20];
char address[50];
char city[20];
char state[10];
} USER;


[other code]

db_add_user_info(USER user_info)
{
char* res;
char tempdata[600];

sprintf(tempdata, "append user (user.name = \"%s\", user.address=\"%s\", 
user.city=\"%s\", user.state=\"%s\") ",
        user_info.name, user_info.address, user_info.city, user_info.state);

PQsetdb("testdb");
PQexec("begin");

res = PQexec(tempdata);
^^^
[ the return values for PQ exec *do not* work! Whenever I made tests using 
the return code, it was *never* correct ]


if (*res == 'E')
        {
        printf("this did not work 1 \n");
        PQexec("end");
        exit();
        }

if (*res == 'I')
        {
        printf("this did not work 2 \n");
        PQexec("end");
        exit();
        }
PQexec("end");
PQfinish();

[Because the return codes do not work above, I had to add another call to 
the server to test if the row actually went in]

}


One must note the importance of setting reasonable and achievable goals for
                    "If you aim for nothing, you'll hit it every time" 
                               -Theodore Roosevelt


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
