dbTalk Databases Forums  

commit?

comp.databases.mysql comp.databases.mysql


Discuss commit? in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SpreadTooThin
 
Posts: n/a

Default commit? - 06-21-2010 , 09:51 PM






I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues.

Reply With Quote
  #2  
Old   
Captain Paralytic
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 04:35 AM






On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:
Quote:
I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues
Only if you are running with the InnoDB transactional engine.

Reply With Quote
  #3  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 01:37 PM



On Jun 22, 3:35*am, Captain Paralytic <paul_laut... (AT) yahoo (DOT) com> wrote:
Quote:
On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.
Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
or is a simple commit statement after every INSERT command sufficient?

Reply With Quote
  #4  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 01:54 PM



On Jun 22, 3:35*am, Captain Paralytic <paul_laut... (AT) yahoo (DOT) com> wrote:
Quote:
On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.
Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
or is a simple commit statement after every INSERT command sufficient?

Reply With Quote
  #5  
Old   
Luuk
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 02:20 PM



Op 22-6-2010 20:37, SpreadTooThin schreef:
Quote:
On Jun 22, 3:35 am, Captain Paralytic<paul_laut... (AT) yahoo (DOT) com> wrote:
On 22 June, 03:51, SpreadTooThin<bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.

Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
i suggest you read this chapter:
http://dev.mysql.com/doc/refman/5.1/...nsactions.html

once, when i have more time, and start using those transactions,
i will read it too ;-)

Quote:
or is a simple commit statement after every INSERT command sufficient?

--
Luuk

Reply With Quote
  #6  
Old   
Peter H. Coffin
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 09:55 PM



On Tue, 22 Jun 2010 11:54:49 -0700 (PDT), SpreadTooThin wrote:
Quote:
On Jun 22, 3:35*am, Captain Paralytic <paul_laut... (AT) yahoo (DOT) com> wrote:
On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.

Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
or is a simple commit statement after every INSERT command sufficient?
It suffices, but it's a lot slower than it needs to be.

--
42. When I capture the hero, I will make sure I also get his dog,
monkey, ferret, or whatever sickeningly cute little animal capable
of untying ropes and filching keys happens to follow him around.
--Peter Anspach's list of things to do as an Evil Overlord

Reply With Quote
  #7  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: commit? - 06-22-2010 , 11:33 PM



On 2010-06-22 20:54, SpreadTooThin wrote:
Quote:
On Jun 22, 3:35 am, Captain Paralytic <paul_laut... (AT) yahoo (DOT) com> wrote:
On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.

Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
or is a simple commit statement after every INSERT command sufficient?
Committing to often or to rarely will both lead to problems.
Transactions are something that needs to be designed to keep your data
consistent and maximise throughput. This will of course be very
difficult without a clear understanding of what a transaction is, so I
suggest you do some reading on transactions, isolation levels and
various phenomena (dirty read, phantom read etc.) that might occur.


/Lennart

Reply With Quote
  #8  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: commit? - 06-23-2010 , 03:04 AM



SpreadTooThin <bjobrien62 (AT) gmail (DOT) com> wrote:
Quote:
On Jun 22, 3:35=A0am, Captain Paralytic <paul_laut... (AT) yahoo (DOT) com> wrote:
On 22 June, 03:51, SpreadTooThin <bjobrie... (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
Must I do a database commit occasionally or after every transaction to
flush transaction queues

Only if you are running with the InnoDB transactional engine.

Indeed I am using InnoDB.
But must this commit be within the scope of a transaction...
or is a simple commit statement after every INSERT command sufficient?
RTFM!

What is auto-commit and how to use explicite transactions:
http://dev.mysql.com/doc/refman/5.1/...var_autocommit
http://dev.mysql.com/doc/refman/5.1/en/commit.html

If auto-commit is good for performance:
http://dev.mysql.com/doc/refman/5.1/...db-tuning.html

how number of inserts per commit influences performance, page 4 here:
http://www.shinguz.ch/MySQL/transaction_performance.pdf


XL

Reply With Quote
  #9  
Old   
John Nagle
 
Posts: n/a

Default Re: commit? - 06-27-2010 , 01:02 PM



On 6/21/2010 10:33 PM, Michael Vilain wrote:
Quote:
In article
2827dca6-3081-4ce7-90e0-945085d9e08b...oglegroups.com>,
SpreadTooThin<bjobrien62 (AT) gmail (DOT) com> wrote:

I use mysql as my database server.
I do a lot of batch adds to a database table.
If you're doing large batch adds, consider the LOAD DATA command.
It's many times faster than doing individual inserts. All the
index updating is done at one time, at the end of the data load,
instead of after each record. See
"http://dev.mysql.com/doc/refman/5.1/en/insert-speed.html"

John Nagle

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.