explain analyze (select * from cdr_data order by id desc limit 10);
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..0.46 rows=10 width=418) (actual time=61.820..96.951 rows=10 loops=1)
-> Index Scan Backward using cdr_data_pkey on cdr_data (cost=0.00..1268387.17 rows=27676900 width=418) (actual time=61.817..96.927 rows=10 loops=1)
Total runtime: 96.992 ms
(3 rows)
explain analyze (select * from cdr_data_master order by id desc limit 10);
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=1850530.19..1850530.21 rows=10 width=100) (actual time=278037.222..278037.245 rows=10 loops=1)
-> Sort (cost=1850530.19..1966777.30 rows=46498846 width=100) (actual time=278037.218..278037.227 rows=10 loops=1)
Sort Key: public.cdr_data_master.id
Sort Method: top-N heapsort Memory: 26kB
-> Result (cost=0.00..845706.84 rows=46498846 width=100) (actual time=14.359..213654.201 rows=46495464 loops=1)
-> Append (cost=0.00..845706.84 rows=46498846 width=100) (actual time=14.357..132664.369 rows=46495464 loops=1)
-> Seq Scan on cdr_data_master (cost=0.00..0.00 rows=1 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_100mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_105mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_10mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_110mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_115mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_120mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_125mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_130mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_135mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_140mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_145mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_150mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_155mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_15mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_160mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_165mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_170mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_175mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_180mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_185mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_190mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_195mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_200mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_20mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_25mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.000..0.000 rows=0 loops=1)
-> Seq Scan on cdr_data_30mln cdr_data_master (cost=0.00..35162.66 rows=1934658 width=100) (actual time=14.310..2524.045 rows=1934658 loops=1)
-> Seq Scan on cdr_data_35mln cdr_data_master (cost=0.00..4475.61 rows=247612 width=100) (actual time=16.907..320.907 rows=247612 loops=1)
-> Seq Scan on cdr_data_40mln cdr_data_master (cost=0.00..1949.81 rows=107813 width=100) (actual time=0.253..140.468 rows=107813 loops=1)
-> Seq Scan on cdr_data_45mln cdr_data_master (cost=0.00..2940.79 rows=162790 width=101) (actual time=0.233..201.041 rows=162790 loops=1)
-> Seq Scan on cdr_data_50mln cdr_data_master (cost=0.00..64148.52 rows=3532521 width=100) (actual time=0.260..4702.547 rows=3532521 loops=1)
-> Seq Scan on cdr_data_55mln cdr_data_master (cost=0.00..90983.00 rows=5000000 width=100) (actual time=12.778..6816.170 rows=5000000 loops=1)
-> Seq Scan on cdr_data_5mln cdr_data_master (cost=0.00..10.14 rows=140 width=532) (actual time=0.001..0.001 rows=0 loops=1)
-> Seq Scan on cdr_data_60mln cdr_data_master (cost=0.00..90966.00 rows=5000000 width=100) (actual time=15.267..7191.117 rows=5000000 loops=1)
-> Seq Scan on cdr_data_65mln cdr_data_master (cost=0.00..90745.99 rows=4999985 width=100) (actual time=0.006..4416.925 rows=5000000 loops=1)
-> Seq Scan on cdr_data_70mln cdr_data_master (cost=0.00..90984.87 rows=4999873 width=100) (actual time=0.004..4479.866 rows=5000000 loops=1)
-> Seq Scan on cdr_data_75mln cdr_data_master (cost=0.00..90957.88 rows=4999883 width=100) (actual time=21.760..7057.975 rows=5000000 loops=1)
-> Seq Scan on cdr_data_80mln cdr_data_master (cost=0.00..90970.00 rows=5000000 width=99) (actual time=11.269..6761.104 rows=5000000 loops=1)
-> Seq Scan on cdr_data_85mln cdr_data_master (cost=0.00..90950.00 rows=5000000 width=99) (actual time=11.657..6516.789 rows=5000000 loops=1)
-> Seq Scan on cdr_data_90mln cdr_data_master (cost=0.00..90934.00 rows=5000000 width=99) (actual time=10.520..6740.251 rows=5000000 loops=1)
-> Seq Scan on cdr_data_95mln cdr_data_master (cost=0.00..9274.07 rows=510070 width=99) (actual time=9.752..695.643 rows=510070 loops=1)
Total runtime: 278037.660 ms
(48 rows)
SHOW constraint_exclusion;
constraint_exclusion
----------------------
on
explain analyze (select * from cdr_data where id>20000000 and id<30000000);
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on cdr_data (cost=3703.24..214997.03 rows=138384 width=418) (actual time=9416.847..31960.503 rows=8040678 loops=1)
Recheck Cond: ((id > 20000000) AND (id < 30000000))
-> Bitmap Index Scan on cdr_data_pkey (cost=0.00..3668.65 rows=138384 width=0) (actual time=9368.697..9368.697 rows=8040678 loops=1)
Index Cond: ((id > 20000000) AND (id < 30000000))
Total runtime: 38382.290 ms
(5 rows)
explain analyze (select * from cdr_data_master where id>60000000 and id<70000000);
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------
Result (cost=0.00..231735.26 rows=10000001 width=100) (actual time=0.014..43035.965 rows=9999999 loops=1)
-> Append (cost=0.00..231735.26 rows=10000001 width=100) (actual time=0.012..25708.944 rows=9999999 loops=1)
-> Index Scan using cdr_data_master_pkey on cdr_data_master (cost=0.00..4.26 rows=1 width=532) (actual time=0.005..0.005 rows=0 loops=1)
Index Cond: ((id > 60000000) AND (id < 70000000))
-> Seq Scan on cdr_data_65mln cdr_data_master (cost=0.00..115746.00 rows=5000000 width=100) (actual time=0.005..4875.700 rows=4999999 loops=1)
Filter: ((id > 60000000) AND (id < 70000000))
-> Seq Scan on cdr_data_70mln cdr_data_master (cost=0.00..115985.00 rows=5000000 width=100) (actual time=0.010..4975.571 rows=5000000 loops=1)
Filter: ((id > 60000000) AND (id < 70000000))
Total runtime: 50992.342 ms
(9 rows)