Open makmanalp opened 10 years ago
Meanwhile in api_csay:
"""Define parameters for query"""
year_where = "AND year = %s" % (year,) if crawler == "" else " "
rca_col = "null"
if trade_flow == "net_export":
val_col = "SUM(export_value - import_value) as val"
elif trade_flow == "net_import":
val_col = "SUM(import_value - export_value) as val"
elif trade_flow == "export":
val_col = "SUM(export_value) as val"
else:
val_col = "SUM(import_value) as val"
def get_countries(input, trade_flow): in views_overview.py
Looks like these are from the rankings pages.
pt-query-digest --since 2014-05-15 /var/lib/mysql/slow-log
reports:This is ridiculous. Median exec time of 14s?!
Culprit seems to be: https://github.com/cid-harvard/atlas-economic-complexity/blob/d86b950564e3b9240fbf2853ae2a88651d54dd25/django_files/observatory/models.py#L458
Explain further says:
The using intersect() and temporary is very ominous indeed. Either preaggregate this or maybe create a compound index.