Re: Is mutliple-execute-one-commit slower than multiple single-execute-single-commit?

Richard Damon <[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>
On 1/29/20 1:42 AM, Peng Yu wrote:
> Hi,
>
> I have two python programs using sqlite3. They function the same,
> except the following.
>
> In the first, execute() is called in batches and then commit() is
> called following them. In the second, commit() is called after each
> execute(). It seems that the second case is faster (I can not separate
> my code in a self-contained test case to show here).
>
> This is counterintuitive. I thought the first should be faster.
>
> Is it expected that the 2nd case should be slightly faster?
>
One thought is that if the execute creates a lot of data for the 
database, then multiple executes could exceed the memory cache, causing 
it to spill to the database, and then the commit needs to read that back 
and put it into the right place, while a commit after each execute keeps 
everything in memory until the commit writes it to the database.

-- 
Richard Damon

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.