Re: PostgreSQL vs MySQL : strange results on insertion
От | Mario Weilguni |
---|---|
Тема | Re: PostgreSQL vs MySQL : strange results on insertion |
Дата | |
Msg-id | 200209052039.55179.mweilguni@sime.com обсуждение исходный текст |
Ответ на | PostgreSQL vs MySQL : strange results on insertion (fpaul@netcourrier.com) |
Список | pgsql-general |
> Time to realize 10000 insertions with PostgreSQL: > $time ./test_postgresql > > real 0m28.568s > user 0m0.390s > sys 0m0.270s > (between 28 and 30 seconds !!!.... ) > > Very strange, isn't it ? Is there something in PostgreSQL's C API that I > didn't understand ? Subtleties during the configuration ? I do not want to > believe that PostgreSQL is 15 times slower than MySQL ! Thank you for any > comment, remark and correction! On my system (compiled for profiling, debugging and slow disk) it takes 2 minutes without transactions, and 4.5 seconds withtransactions: #include <stdio.h> #include <libpq-fe.h> #define INSERTION "INSERT INTO test (type_int, type, type_int2, type_text) VALUES (%d,\'essai de chaine decaractère\',100,\'MAJUSCULESet minuscules\')" int main(int argc, char **argv) { PGconn *conn; unsigned int i; char mquery[1000]; PGresult *res; conn=PQconnectdb("dbname=mario"); if (PQstatus(conn) == CONNECTION_OK) { res=PQexec(conn,"begin"); PQclear(res); for (i=0;i<=10000;i++) { sprintf(mquery,INSERTION,i); res=PQexec(conn,mquery); if (PQresultStatus(res)!= PGRES_COMMAND_OK) { printf("sql query error (%s) : %s\n", mquery,PQresultErrorMessage(res)); PQclear(res); res=PQexec(conn,"commit "); PQclear(res); PQfinish(conn); return 0; } } PQclear(res); PQfinish(conn); } else { printf("sql connection error :%s\n",PQerrorMessage(conn)); return 0; } return 0; } best regards, mario weilguni
В списке pgsql-general по дате отправления: