[Gambas-user] Hopefully, an optimisation for gb.db.postgresql
Benoît Minisini
gambas at ...1...
Tue Dec 13 06:08:28 CET 2011
Le 12/12/2011 09:01, Bruce Bruen a écrit :
> Hi Benoit,
>
> I was tracing through the postgresql library trying to figure out why
> some tables would add, update or delete single rows in milliseconds and
> others took "seconds".
> I found that the table_init function in gb.db.postgresql Main.c is
> calling the field_info function for each and every column in the table.
> Which in turn is querying the database catalogue for each column.
> Thus in a table with a large number of columns, calls to .Create
> and .Edit in gambas were taking close on half a second each (with a test
> table of 46 columns and the database on another server).
>
> With my LIMITED C knowledge I have hacked the table_init queries so that
> the required catalogue columns are returned in the intial query and
> moved what I hope is the relevant code from field_info into
> table_init.
>
> My limited testing shows that .Create and .Edit call timings have now
> dropped to the order of .02 seconds, and the overall add, update and
> delete times drop to around .05 seconds. That is an order of 10 times
> faster.
>
> Would you please take a look at the code for table_init below and see if
> it makes sense to go this way. (The code copies and pastes OK into an
> editor like geany, even though the mail may wrap lines ... so I hope you
> can read it OK).
>
> regards
> Bruce
>
Cool optimization apparently...
Can you send me your code as an attachment so that I can open it
directly in an editor to check it?
Thanks in advance!
--
Benoît Minisini
More information about the User
mailing list