Re: [GENERAL] slow inserts and updates on large tables

From: jim(at)reptiles(dot)org (Jim Mercer)
To: herouth(at)oumail(dot)openu(dot)ac(dot)il (Herouth Maoz)
Cc: jim(at)reptiles(dot)org, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] slow inserts and updates on large tables
Date: 1999-02-17 14:47:26
Message-ID: m10D8G6-00080dC@mailbox.reptiles.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> At 16:10 +0200 on 17/2/99, Jim Mercer wrote:
> You probably didn't understand me. If you convert it to tab delimited text
> and then use COPY table_name FROM filename/stdin instead of INSERT, it will
> be much faster, because you don't have to do the parsing and planning on
> each line, but only on the whole copy.
>
> I didn't tell you to use the data directly from those text files...
>
> PQexec( con, "COPY table1 FROM stdin" );
>
> while (data_still_coming) {
>
> sprintf( line, "%s\t%s\t%s\n" , item1, item2, item3 );
> PQputline( con, line );
>
> }
>
> PQputline( con, ".\n" );
> PQendcopy(con);

i will test this with my insertama program, but i see some problems with this.

firstly, it assumes that all of your applications programs are updated each
time you modify the structure of the table.

i am using "insert into testtable (fieldname1, fieldname2) values ('1', '2');"

this allows the applications to remain unchanged if new fields are added.

also, it doesn't seem to address the issue of updates, which suffer from worse
performance than inserts.

what is a realistic number of inserts per second under postgresql, with or
without an index?

--
[ Jim Mercer Reptilian Research jim(at)reptiles(dot)org +1 416 410-5633 ]
[ The telephone, for those of you who have forgotten, was a commonly used ]
[ communications technology in the days before electronic mail. ]
[ They're still easy to find in most large cities. -- Nathaniel Borenstein ]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Herouth Maoz 1999-02-17 14:57:24 Re: [GENERAL] slow inserts and updates on large tables
Previous Message Herouth Maoz 1999-02-17 14:34:41 Re: [GENERAL] slow inserts and updates on large tables