Created
July 11, 2015 17:35
-
-
Save franckverrot/b29ee065e0fdf8564300 to your computer and use it in GitHub Desktop.
Subplans :-((((
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 1; | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..12.57 rows=1 width=7138) (actual time=198.759..198.760 rows=1 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=198.758..198.758 rows=1 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=198.743..198.743 rows=1 loops=1) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=101.312..198.737 rows=1 loops=1) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.218 ms | |
Execution time: 224.345 ms | |
(9 rows) | |
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 2; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..25.15 rows=2 width=7138) (actual time=196.023..299.099 rows=2 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=196.023..299.098 rows=2 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=149.542..149.542 rows=1 loops=2) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=50.977..149.538 rows=1 loops=2) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.113 ms | |
Execution time: 305.532 ms | |
(9 rows) | |
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 3; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..37.72 rows=3 width=7138) (actual time=200.269..392.912 rows=3 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=200.269..392.911 rows=3 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=130.964..130.964 rows=1 loops=3) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=33.550..130.960 rows=1 loops=3) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.151 ms | |
Execution time: 399.141 ms | |
(9 rows) | |
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 4; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..50.30 rows=4 width=7138) (actual time=197.629..484.626 rows=4 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=197.629..484.624 rows=4 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=121.149..121.149 rows=1 loops=4) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=25.212..121.145 rows=1 loops=4) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.178 ms | |
Execution time: 491.770 ms | |
(9 rows) | |
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 5; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..62.87 rows=5 width=7138) (actual time=199.419..597.329 rows=5 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=199.417..597.324 rows=5 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=119.458..119.458 rows=1 loops=5) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=20.467..119.454 rows=1 loops=5) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.163 ms | |
Execution time: 604.301 ms | |
(9 rows) | |
# explain analyze select *, (select count(1) from generate_series(1,1000000) where users.id = generate_series) from users limit 6; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------- | |
Limit (cost=0.00..75.45 rows=6 width=7138) (actual time=202.033..706.104 rows=6 loops=1) | |
-> Seq Scan on users (cost=0.00..314.37 rows=25 width=7138) (actual time=202.033..706.102 rows=6 loops=1) | |
SubPlan 1 | |
-> Aggregate (cost=12.51..12.52 rows=1 width=0) (actual time=117.677..117.678 rows=1 loops=6) | |
-> Function Scan on generate_series (cost=0.00..12.50 rows=5 width=0) (actual time=16.958..117.675 rows=1 loops=6) | |
Filter: (users.id = generate_series) | |
Rows Removed by Filter: 999999 | |
Planning time: 0.103 ms | |
Execution time: 712.495 ms | |
(9 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment