Guest User

Untitled

a guest
Jun 24th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. portal=# explain analyze SELECT t1.detectorid, description, t1.total as count, t3.total,
  2. CAST(t1.total AS NUMERIC) / CAST(t3.total AS NUMERIC) * 100.0 AS percentage
  3. FROM selena.test_agg t1,
  4. (SELECT detectorid, COUNT(*) AS total
  5. FROM loopdata_2007_01_01 t2
  6. GROUP BY detectorid
  7. ORDER BY detectorid) t3
  8. WHERE t1.detectorid = t3.detectorid
  9. ORDER BY t1.detectorid, description, t3.total;
  10. QUERY PLAN
  11. -----------------------------------------------------------------------------------------------------------------------------------------------------------
  12. Sort (cost=58441.89..58445.35 rows=1386 width=23) (actual time=3710.908..3711.626 rows=1386 loops=1)
  13. Sort Key: t1.detectorid, t1.description, (count(*))
  14. Sort Method: quicksort Memory: 178kB
  15. -> Hash Join (cost=58329.22..58369.56 rows=1386 width=23) (actual time=3706.265..3709.472 rows=1386 loops=1)
  16. Hash Cond: (t2.detectorid = t1.detectorid)
  17. -> Sort (cost=58289.03..58290.61 rows=631 width=2) (actual time=3704.244..3704.582 rows=631 loops=1)
  18. Sort Key: t2.detectorid
  19. Sort Method: quicksort Memory: 54kB
  20. -> HashAggregate (cost=58251.80..58259.69 rows=631 width=2) (actual time=3703.257..3703.661 rows=631 loops=1)
  21. -> Seq Scan on loopdata_2007_01_01 t2 (cost=0.00..44622.20 rows=2725920 width=2) (actual time=0.029..1636.145 rows=2725920 loops=1)
  22. -> Hash (cost=22.86..22.86 rows=1386 width=15) (actual time=1.989..1.989 rows=1386 loops=1)
  23. -> Seq Scan on test_agg t1 (cost=0.00..22.86 rows=1386 width=15) (actual time=0.042..1.014 rows=1386 loops=1)
  24. Total runtime: 3712.429 ms
  25. (13 rows)
Add Comment
Please, Sign In to add comment