Create a gist now

Instantly share code, notes, and snippets.

InnoDB 1GB data
#!/usr/bin/python
import MySQLdb
import time
conn = MySQLdb.connect(host="localhost", db= "benchmark", read_default_file="~/.my.cnf")
cursor = conn.cursor()
id = 1
count = 28200000
t = time.time()
while id <= count:
query = 'INSERT INTO t VALUES(%d, "woop")' % id
cursor.execute(query)
id = id + 1
cursor.close()
conn.commit()
conn.close()
diff = time.time() - t
print '%d rows in %d secs (%d inserts/sec)' % (count, diff, count/diff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment