Monotone-Revision: 9054022ef1ca8aeba6e34842d27d9b94ce002b89 Monotone-Author: dev-unix.inverse.qc.ca Monotone-Date: 2006-06-15T19:34:10 Monotone-Branch: ca.inverse.sogo
25 lines
656 B
Python
Executable file
25 lines
656 B
Python
Executable file
#!/usr/bin/python
|
|
|
|
import pg, time
|
|
|
|
USER="agenor"
|
|
HOST="localhost"
|
|
DB="agenor_testhugeperf"
|
|
TABLE="SOGo_huge_quick"
|
|
|
|
db = pg.DB(DB, HOST, 5432, "", "", USER);
|
|
print "connection:", db
|
|
|
|
def timeSelect(SELECT, WHERE=None):
|
|
SQL="SELECT %s FROM %s" % ( SELECT, TABLE )
|
|
if not WHERE is None: SQL="%s WHERE %s" % ( SQL, WHERE )
|
|
starttime=time.time()
|
|
res = db.query(SQL)
|
|
endtime=time.time()
|
|
print "perf '%s', %s: %.2fms" % ( SELECT, WHERE, (endtime-starttime)*1000)
|
|
|
|
timeSelect("COUNT(*)")
|
|
timeSelect("c_pkey, c_sourceid, c_startdate, c_enddate",
|
|
"c_startdate > 1085068363 AND c_startdate < 1085068373")
|
|
timeSelect("c_sourceid")
|