Re: [HACKERS] Profile of current backend - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: [HACKERS] Profile of current backend
Date
Msg-id 199802101510.QAA20626@gauss.topsystem.de
Whole thread Raw
In response to Re: [HACKERS] Profile of current backend  (The Hermit Hacker <scrappy@hub.org>)
Responses Re: [HACKERS] Profile of current backend  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
The Hermit Hacker writes:
>     Just curious, but do you have -F set to disable fsync()?  We
> really really should disable that by default :(

I tried with -F and it runs nicely. No difference to see between PostgreSQL
and Oracle. I just ran another test which includes table creation, inserts
and drop (source follows). Here's the result:

Oracle 7.3.3.4.0:
I needed 21 seconds and -345682 microseconds for this test

PostgreSQL without -F:
I needed 152 seconds and -623545 microseconds for this test

PostgreSQL with -F:
I needed 5 seconds and 84411 microseconds for this test

Whow!

Here's the source (yes, our precompiler can handle this kind of program
already :-)):

#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>

exec sql include sqlca;

#define       SQLCODE    sqlca.sqlcode

void
db_error (char *msg)
{
    sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
    printf ("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
    exit (1);
}

int
main ()
{
exec sql begin declare section;
    long i;
exec sql end declare section;
    struct timeval tvs, tve;

    gettimeofday(&tvs, NULL);

    exec sql connect 'mm';
    if (SQLCODE)
        db_error ("connect");

    exec sql create table perftest(number int4, ascii char16);
    if (SQLCODE)
                db_error ("create t");

    exec sql create unique index number on perftest(number);
    if (SQLCODE)
                db_error ("create i");

    for (i = 0;i < 1407; i++)
    {
        exec sql begin declare section;
            char text[16];
        exec sql end declare section;

        sprintf(text, "%ld", i);
        exec sql insert into perftest(number, ascii) values (:i, :text);
        if (SQLCODE)
            db_error ("insert");

        exec sql commit;
        if (SQLCODE)
            db_error ("commit");
    }

    exec sql drop index number;
    if (SQLCODE)
        db_error ("drop i");

    exec sql drop table perftest;
    if (SQLCODE)
        db_error ("drop t");

    exec sql commit;
    if (SQLCODE)
        db_error ("commit");

    gettimeofday(&tve, NULL);

    printf("I needed %ld seconds and %ld microseconds for this test\n", tve.tv_sec - tvs.tv_sec, tve.tv_usec -
tvs.tv_usec);

    return (0);
}

Michael

--
Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
meskes@debian.org                      | 52146 Wuerselen
Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10

pgsql-hackers by date:

Previous
From: darrenk@insightdist.com (Darren King)
Date:
Subject: Re: [HACKERS] AIX port s_lock.h __AIX --> _AIX
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Profile of current backend