mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 19:49:49 +00:00
Added basic timing instrumentation, updated TODO,
...added new smaller sample size (10k row table)
This commit is contained in:
parent
ccc89019d5
commit
52e58670f2
@ -1,6 +1,9 @@
|
||||
-change hacked up query syntax into one with variable substitution and character escaping
|
||||
mysqldb variable substitution only works correctly for column values - may NOT be used on statements, table names
|
||||
-make the prototype scale to the huge db
|
||||
finished stubbed out scale_query()
|
||||
include a cron.daily entry that can be used to regenerate the subsamples
|
||||
add more evaluator functions - these test whether a query returned enough results
|
||||
-add new views
|
||||
-code clean up
|
||||
-make object oriented
|
||||
-add a debug mode and a production mode
|
||||
|
Binary file not shown.
@ -17,6 +17,7 @@ import MySQLdb
|
||||
import types
|
||||
import configuration
|
||||
import evaluators
|
||||
import time
|
||||
|
||||
from turbogears import controllers, expose, flash
|
||||
# from wesstats import model
|
||||
@ -37,6 +38,7 @@ class Root(controllers.RootController):
|
||||
return l
|
||||
|
||||
def scaled_query(self,curs,query,threshold,evaluator):
|
||||
s_time = time.time()
|
||||
#list of all the sample sizes
|
||||
curs.execute("SELECT TABLE_NAME FROM information_schema.tables WHERE `TABLE_NAME` REGEXP '^"+configuration.DB_TABLE_PREFIX+"SMPL'")
|
||||
results = curs.fetchall()
|
||||
@ -54,9 +56,11 @@ class Root(controllers.RootController):
|
||||
results = curs.fetchall()
|
||||
length = evaluator(results)
|
||||
if length > threshold:
|
||||
print "query took " + str(time.time()-s_time) + " seconds"
|
||||
return results
|
||||
print "samples too small, using entire table"
|
||||
curs.execute(query)
|
||||
print "query took " + str(time.time()-s_time) + " seconds"
|
||||
return curs.fetchall()
|
||||
|
||||
def fconstruct(self,filters,colname,list):
|
||||
|
@ -45,3 +45,4 @@ def sample(size):
|
||||
|
||||
sample(10**6) #1 mil row subsample
|
||||
sample(10**5) #100k row subsample
|
||||
sample(10**4) #10k row subsample
|
||||
|
Loading…
x
Reference in New Issue
Block a user