What is the time complexity of simple SQL statements like the following?
INSERT into table (col1, col2, col3) values ("a", "b", "c")
How does it depend on the following:
- size of the table
- datatype of col1, col2
- number of columns in the table viz. col1, col2, col3, etc
Does this depend on whether I am using MyISAM or InnoDB?
The MySQL 5.0 documentation has a nice page on this topic.
The article provides approximate proportial costs for each of the subtasks involved in an insertion task.
The rest of article provides techniques for speeding up insertions, useful if insert speed becomes a bottleneck in your application.