views:

363

answers:

3

I have a simple table in MySql whose raison-d'être is to store logs. The table has an autoincremented sequence and all the other columns has zero referential integrity to other tables. There are no unique keys or indexes on any columns. The column with autoincrement is the primary key.

Will concurrent INSERTs ever interfere with each other ? I define interference to mean losing data.

I am using autocommit=true for this insert.

+2  A: 

Yes. For InnoDB , more information here

Learning
Do you want to merge posts?
David Grant
+2  A: 

From the MySQL manual for the MyISAM storage engine:

"MyISAM supports concurrent inserts..."
David Grant
+1 Between the two of us , I guess the question is now covered :)
Learning
+2  A: 

You'll never lose data just because you do simultaneous inserts. If you use transactions you might "lose" some IDs - but no actual data. (Imagine that you start a transaction, insert a few rows and then do a rollback. InnoDB will have allocated the auto_increment IDs , but there are no rows with those IDs because you did the rollback).

Since you don't need indexes, you should have a look at the ARCHIVE table engine. It's amazingly insanely fast -- and your tables gets much smaller which in turn makes the table scans when you read the table later MUCH faster.

Ask Bjørn Hansen
I experienced the archive table engine to be much slower than other engines, especially when filtering values, as there are no indexes supported in the engine...
Cassy
Cassy - yes, indeed. If you can use indexes effectively then a table type with indexes will be faster. Often you cannot though; and full scans on archive tables are as fast as they can get. You'd then "on demand" table scan the relevant data into a summary table (with indexes) and query that one.
Ask Bjørn Hansen