couple of things

1) That is a fairly old version of postgres, there are considerable performance improvements in the last 2 releases since, and even more in the pending release.
2) If you are going to insert more rows than that, consider dropping the index before, and recreating after the insert.


Michael Kleiser wrote:

Im PostgreSQL 7.2.2 / Linux 2.4.27  dual-processor Pentium III 900MHz,

we have this table:

create table testtable (id SERIAL PRIMARY KEY, coni VARCHAR(255), date TIMESTAMP, direction VARCHAR(255), partner VARCHAR(255), type VARCHAR(255), block VARCHAR(255) );

We using Java with JDBC-driver pg72jdbc2.jar

our Java-testgrogram is :

public class Stresser implements Runnable {
public void run() {
System.out.println("-> start");
try {
Connection con = DriverManager.getConnection("jdbc:postgresql://"+prop.getProperty("host")+":"+prop.getProperty("port")+"/"+prop.getProperty("dbname"), prop.getProperty("user"), prop.getProperty("pwd"));
Statement st = con.createStatement();
java.sql.Timestamp datum = new java.sql.Timestamp(new Date().getTime());
Date start = new Date();
for (int i=0; i<100; ++i) {
st.executeUpdate("insert into history(uuid,coni,date,direction,partner,type) values('uuid','content','"+datum+"','dir','partner','type')");
Date end = new Date();
} catch (Exception e) {
System.out.println("-> ende");

    public static void main(String[] args) {

        for (int i=0; i<10; ++i) {
            Stresser s = new Stresser();
            Thread t = new Thread(s);

It is trunning in in 10 Threads. Each thread makes 100 Inserts:

For the 1000 Inserts (10 threads a 100 inserts)
we need 8 seconds.
That's 125 Insets / Seconds.

How could we make it faster ?

Inserting 1000 rows via  INSERT AS SELECT is much faster.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

-- Dave Cramer 519 939 0336 ICQ#14675561

---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

Reply via email to