Created
July 15, 2011 15:43
-
-
Save santisaez/1084927 to your computer and use it in GitHub Desktop.
InnoDB 1GB data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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