Skip to content

Instantly share code, notes, and snippets.

@d108
Created February 22, 2014 09:39
Show Gist options
  • Save d108/9151223 to your computer and use it in GitHub Desktop.
Save d108/9151223 to your computer and use it in GitHub Desktop.
Query Plan Before GROUP BY
SELECT
"Interval".end_time,
"MeterData".meter_name,
"Reading".channel
FROM
"MeterData"
INNER JOIN "IntervalReadData" ON "MeterData".meter_data_id = "IntervalReadData".meter_data_id
INNER JOIN "Interval" ON "IntervalReadData".interval_read_data_id = "Interval".interval_read_data_id
INNER JOIN "Reading" ON "Interval".interval_id = "Reading".interval_id
-- Query Plan:
Hash Join (cost=399095.74..1284498.39 rows=17154293 width=19)
Hash Cond: ("Reading".interval_id = "Interval".interval_id)
-> Seq Scan on "Reading" (cost=0.00..307110.93 rows=17154293 width=10)
-> Hash (cost=268306.51..268306.51 rows=6764018 width=25)
-> Hash Join (cost=567.97..268306.51 rows=6764018 width=25)
Hash Cond: ("Interval".interval_read_data_id = "IntervalReadData".interval_read_data_id)
-> Seq Scan on "Interval" (cost=0.00..132458.18 rows=6764018 width=24)
-> Hash (cost=487.42..487.42 rows=6444 width=17)
-> Hash Join (cost=235.10..487.42 rows=6444 width=17)
Hash Cond: ("IntervalReadData".meter_data_id = "MeterData".meter_data_id)
-> Seq Scan on "IntervalReadData" (cost=0.00..123.44 rows=6444 width=16)
-> Hash (cost=154.49..154.49 rows=6449 width=17)
-> Seq Scan on "MeterData" (cost=0.00..154.49 rows=6449 width=17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment