Skip to content

Instantly share code, notes, and snippets.

@lfittl
Last active August 29, 2015 14:02
Show Gist options
  • Save lfittl/675b707b7c57dee3dd14 to your computer and use it in GitHub Desktop.
Save lfittl/675b707b7c57dee3dd14 to your computer and use it in GitHub Desktop.
AVG | QUERY
---------------------------------------------------------------------------------
96.5ms | SELECT q.classification, date_part(?, qsh.collected_at) AS collected_at, SUM(qsh.total_time) / SUM(qsh.calls) AS avg FROM query_snapshot_hourlies qsh JOIN queries q ON (qsh.query_id = q.id) WHERE qsh.database_id = ? AND qsh.collected_at BETWEEN ? AND ? AND q.database_id = ? AND NOT truncated GROUP BY q.classification, qsh.collected_at ORDER BY qsh.collected_at
87.4ms | SELECT q.id AS query_id, normalized_query, classification, SUM(total_time) AS total_time, SUM(calls) AS calls, SUM(total_time) / SUM(calls) AS avg_time FROM query_snapshot_hourlies qsh JOIN queries q ON (qsh.query_id = q.id) WHERE qsh.database_id = ? AND qsh.collected_at BETWEEN ? AND ? AND q.database_id = ? AND NOT truncated AND (q.classification IS NULL OR q.classification IN (?)) GROUP BY q.id
47.9ms | SELECT "schema_indices".* FROM "schema_indices" INNER JOIN "schema_tables" ON "schema_indices"."table_id" = "schema_tables"."id" WHERE "schema_tables"."database_id" = $1 AND "schema_indices"."invalidated_at_snapshot_id" IS NULL ORDER BY "schema_indices"."id" ASC LIMIT ?
18.2ms | SELECT query_id, date_part(?, collected_at) AS collected_at, SUM(total_time) / SUM(calls) AS avg FROM query_snapshot_hourlies qs WHERE database_id = ? AND collected_at BETWEEN ? AND ? AND query_id = ? GROUP BY query_id, collected_at ORDER BY collected_at
1.0ms | SELECT "schema_table_stats".* FROM "schema_table_stats" WHERE "schema_table_stats"."snapshot_id" = $1
0.8ms | SELECT "schema_tables".* FROM "schema_tables" WHERE "schema_tables"."database_id" = $1 AND "schema_tables"."invalidated_at_snapshot_id" IS NULL ORDER BY "schema_tables"."id" ASC LIMIT 1
0.7ms | SELECT "schema_tables".* FROM "schema_tables" WHERE "schema_tables"."id" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
0.6ms | SELECT "issues".* FROM "issues" WHERE "issues"."database_id" = $1 AND "issues"."reference_type" = ? AND "issues"."reference_id" = ? AND ("issues"."current_state" != ?) AND "issues"."silence" = ?
0.6ms | SELECT "schema_constraints".* FROM "schema_constraints" WHERE "schema_constraints"."table_id" = $1 AND "schema_constraints"."invalidated_at_snapshot_id" IS NULL
0.2ms | SELECT "schema_indices".* FROM "schema_indices" WHERE "schema_indices"."table_id" = $1 AND "schema_indices"."invalidated_at_snapshot_id" IS NULL
0.2ms | SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = ?::regclass AND a.attnum > ? AND NOT a.attisdropped ORDER BY a.attnum
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment