Skip to content

Instantly share code, notes, and snippets.

@santisaez
Created July 15, 2011 15:43
Show Gist options
  • Save santisaez/1084927 to your computer and use it in GitHub Desktop.
Save santisaez/1084927 to your computer and use it in GitHub Desktop.
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