Skip to content

Instantly share code, notes, and snippets.

@llimllib
Created September 5, 2012 14:31
Show Gist options
  • Save llimllib/3637502 to your computer and use it in GitHub Desktop.
Save llimllib/3637502 to your computer and use it in GitHub Desktop.
redis elapsed: 0.00105381011963
1234567890
pg elapsed: 0.00156402587891
1234567890
import time
from redis import Redis
r = Redis()
s1 = time.time()
c = r.execute_command("get", "test")
s2 = time.time()
print "redis elapsed: ", s2-s1
print c[:10]
from psycopg2 import connect
conn = connect("dbname=fuse_test user=bill")
cur = conn.cursor()
s1 = time.time()
cur.execute("SELECT value FROM metrics")
c = cur.fetchone()
s2 = time.time()
print "pg elapsed: ", s2-s1
print c[0][:10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment