[Solved] [SQLite] DatabaseUpdate ultra slow

Everything else that doesn't fall into one of the other PB categories.
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

[Solved] [SQLite] DatabaseUpdate ultra slow

Post by grabiller »

Hi,

Before I post some code and go into more details, I'm assuming DatabaseUpdate() do a commit on each request.

I'm building a database with all OpenGL constants and functions signatures, so far I'm adding to the database around 600 constants in a table.

It takes 30 to 40 seconds to do so :shock:

By the past I've used SQLite extensively in C and I've been able to add much more data in one shot for a fraction of the time.

So I'm wondering if it is possible from native PureBasic Database commands to use DatabaseUpdate() in a way it won't commit every time and then we do a commit at the end ?

I did not find infos on this. But perhaps I'm not using the native PB Database commands correctly.

Have you experienced such timing with lot of additions into a SQLite databases with native PB commands ?
Last edited by grabiller on Sun Oct 28, 2012 4:19 pm, edited 1 time in total.
guy rabiller | radfac founder / ceo | raafal.org
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: [SQLite] DatabaseUpdate ultra slow

Post by DarkDragon »

Afaik its the database, which does the commit on every command if no transaction was opened. To open a transaction use this:
http://www.sqlite.org/lang_transaction.html

[EDIT]
Ugh, the forums wen't down when I tried to send it.
bye,
Daniel
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: [SQLite] DatabaseUpdate ultra slow

Post by grabiller »

Oh right,

I forgot about the SQL BEGIN/COMMIT commands.., sorry about that. In C I was using apis encapsulating that into specific functions.

I just have to:

Code: Select all

DatabaseUpdate( dbid, "BEGIN;" )

DatabaseUpdate( dbid, "INSERT INTO ../.." )
DatabaseUpdate( dbid, "INSERT INTO ../.." )
; ../..

DatabaseUpdate( dbid, "COMMIT;" )
And now it takes less than a second. :wink:

Thanks for reminding me.
guy rabiller | radfac founder / ceo | raafal.org
r7mk4
User
User
Posts: 13
Joined: Tue Aug 02, 2005 2:23 pm

Re: [Solved] [SQLite] DatabaseUpdate ultra slow

Post by r7mk4 »

Ten years later....

Same thing here!
You solved it!

Thank's a lot :lol:
Post Reply