explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wXHx : Fast (v2, w/ metric-timestamp btree index)

Settings
# exclusive inclusive rows x rows loops node
1. 19.749 94.841 ↑ 2.7 43 1

GroupAggregate (cost=47,933.49..47,938.51 rows=118 width=228) (actual time=71.050..94.841 rows=43 loops=1)

  • Group Key: sims.iccid, (("ts-values".value_meta ->> 'carrierCountryCode'::text))
2. 51.597 75.092 ↓ 103.7 12,239 1

Sort (cost=47,933.49..47,933.79 rows=118 width=279) (actual time=71.040..75.092 rows=12,239 loops=1)

  • Sort Key: sims.iccid, (("ts-values".value_meta ->> 'carrierCountryCode'::text))
  • Sort Method: external merge Disk: 3376kB
3. 11.556 23.495 ↓ 103.7 12,239 1

Hash Right Join (cost=71.91..47,929.43 rows=118 width=279) (actual time=0.406..23.495 rows=12,239 loops=1)

  • Hash Cond: (("ts-metrics".dimensions ->> 'iccid'::text) = (sims.iccid)::text)
4. 5.708 11.704 ↑ 1.4 12,263 1

Nested Loop (cost=0.43..47,645.66 rows=16,645 width=268) (actual time=0.030..11.704 rows=12,263 loops=1)

5. 0.087 0.087 ↑ 1.1 311 1

Seq Scan on "ts-metrics" (cost=0.00..10.29 rows=329 width=98) (actual time=0.003..0.087 rows=311 loops=1)

6. 5.909 5.909 ↑ 1.4 39 311

Index Scan using "metric-timestamp" on "ts-values" (cost=0.43..144.24 rows=55 width=178) (actual time=0.003..0.019 rows=39 loops=311)

  • Index Cond: ((metric_id = "ts-metrics".id) AND ("timestamp" >= '2019-01-04 07:00:00+00'::timestamp with time zone) AND ("timestamp" <= '2019-01-05 06:59:59.999+00'::timestamp with time zone))
7. 0.022 0.235 ↓ 10.8 43 1

Hash (cost=71.43..71.43 rows=4 width=73) (actual time=0.235..0.235 rows=43 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
8. 0.213 0.213 ↓ 10.8 43 1

Seq Scan on sims (cost=0.00..71.43 rows=4 width=73) (actual time=0.007..0.213 rows=43 loops=1)

  • Filter: ((("clientSlug")::text = 'global'::text) AND (("providerSlug")::text = 'bell'::text))
  • Rows Removed by Filter: 519