What the complexity in big O notation of adding n entries to a database with m entries with i indexes in MySQL and afterwards committing?
Mysql – Complexity of adding n entries to a database
databasemysqlsql
Related Question
- Sql – How to list the tables in a SQLite database file that was opened with ATTACH
- Mysql – Should I use the datetime or timestamp data type in MySQL
- Mysql – How to get a list of user accounts using the command line in MySQL
- Sql – What are the options for storing hierarchical data in a relational database
- Mysql – How to get the sizes of the tables of a MySQL database
- Mysql – How to import an SQL file using the command line in MySQL
Best Solution
Inserting into a
MyISAM
table without indexes takesO(n)
(linear) time.Inserting into an
InnoDB
table and into any index takeslog(m) * O(n)
(linear time depending on the number of already existing records) time (assumingm >> n
), sinceInnoDB
tables and indexes areB-Trees
.Overall time is the sum of these values.