This file contains hidden or 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
feed_insights=# explain select count(distinct(user_id)) from interests where keywords in (select keywords from interests group by keywords having count(*) > 30); | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------- | |
Aggregate (cost=2232807.48..2232807.49 rows=1 width=4) | |
-> Hash Join (cost=1780566.44..2221413.32 rows=4557663 width=4) | |
Hash Cond: (public.interests.keywords = public.interests.keywords) | |
-> Seq Scan on interests (cost=0.00..172441.36 rows=9188836 width=19) | |
-> Hash (cost=1778239.13..1778239.13 rows=133865 width=15) | |
-> GroupAggregate (cost=1706310.89..1776900.48 rows=133865 width=15) | |
Filter: (count(*) > 30) |
This file contains hidden or 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
import time | |
input = ['a', 'b', 'c', 'd', 'e', 'f'] | |
iterations = 1000000 | |
start = time.time() | |
for i in xrange(iterations): | |
s = dict([(x.lower(), i) for i, x in enumerate(input)]) | |
end = time.time() | |
print "First thing took %s seconds" % (end - start) |
NewerOlder