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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

BUG #4079: libpq.dll very slow (unusable)


  • From: "Pavel Golub" <pavel(at)microolap(dot)com>
  • To: pgsql-bugs(at)postgresql(dot)org
  • Subject: BUG #4079: libpq.dll very slow (unusable)
  • Date: Tue, 1 Apr 2008 14:03:22 GMT
  • Message-id: <200804011403(dot)m31E3MSD058056(at)wwwmaster(dot)postgresql(dot)org>

The following bug has been logged online:

Bug reference:      4079
Logged by:          Pavel Golub
Email address:      pavel(at)microolap(dot)com
PostgreSQL version: 8.3.1
Operating system:   Windows XP SP2
Description:        libpq.dll very slow (unusable)
Details: 

Comparing 8.3.1 to 8.2.5 release INSERT of >1000 rows is very slow.

CREATE TABLE numbers
(
  numberint integer NOT NULL,
  numberstr character varying(80),
  CONSTRAINT numbers_pkey PRIMARY KEY (numberint)
);

Inserts:
INSERT INTO numbers (numberint, numberstr) VALUES (1, 'One');
INSERT INTO numbers (numberint, numberstr) VALUES (2, 'Two');
INSERT INTO numbers (numberint, numberstr) VALUES (3, 'Three');
...
INSERT INTO numbers (numberint, numberstr) VALUES (1000, 'One thousand');

Program written on Delphi. Using libpq.dll 8.3.1.8075, and libpq 8.2.5.7260.
Both of them give the same results.

procedure Main(Db: TPSQLDatabase; SQL: string);
var
  conninfo: string;
  Conn: PGConn;
  Res: PGResult;
  cStart, cStop: cardinal;
begin
  with Db do
   Conninfo := Format('host = ''%s'' dbname = ''%s'' user = ''%s'' password
= ''%s'' port=''%d''',
          [Host, DatabaseName, UserName, UserPassword, Port]);

  Conn := PQConnectdb(PChar(ConnInfo));

  If PQStatus(Conn) <> CONNECTION_OK then
   begin
    ShowMessage('CAN''T START connection!');
    PQFinish(Conn);
    Exit;
   end;

   cStart:=GetTickCount();

   Res := PQExec(conn,PChar(SQL));
   if PQResultStatus(res) <> PGRES_COMMAND_OK then
       ShowMessage('CAN''T EXECUTE INSERTS');

  cStop:=GetTickCount();
  InfoMemo.Lines.Add('Execution time: '+IntToStr(cStop-cStart)+'ms');

  PQClear(res);
  PQFinish(Conn);
end;

Results with 10000 INSERTS:
- 984ms on PostgreSQL 8.2.7
- 25953ms on PostgreSQL 8.3.1 

Result with 50000 INSERTS:
- 5063ms on PosgreSQL 8.2.7
- 26 minutes on PosgreSQL 8.3.1 (with 100% CPU usage)

The same behavior for pgAdmin III.

But psql works well when executing the request on both 8.2 and 8.3.

Tests were made under Windows XP only.



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group