By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
DROP TABLE
CREATE TABLE
INSERT 0 2000000
ANALYZE
CREATE INDEX
| QUERY PLAN |
|---|
| Limit (cost=8.46..8.46 rows=1 width=4) (actual time=0.175..0.176 rows=0 loops=1) |
| -> Sort (cost=8.46..8.46 rows=1 width=4) (actual time=0.019..0.019 rows=0 loops=1) |
| Sort Key: order_id |
| Sort Method: quicksort Memory: 25kB |
| -> Index Only Scan using orders_test_shipping_date_order_id_idx on orders_test (cost=0.43..8.45 rows=1 width=4) (actual time=0.010..0.011 rows=0 loops=1) |
| Index Cond: ((shipping_date >= '2022-05-01'::date) AND (shipping_date <= '2022-05-01'::date)) |
| Heap Fetches: 0 |
| Planning Time: 1.350 ms |
| Execution Time: 0.395 ms |
EXPLAIN
INSERT 0 100000
ANALYZE
| QUERY PLAN |
|---|
| Limit (cost=0.43..37.43 rows=50 width=4) (actual time=356.130..356.151 rows=50 loops=1) |
| -> Index Scan using orders_test_pkey on orders_test (cost=0.43..74336.43 rows=100451 width=4) (actual time=356.128..356.145 rows=50 loops=1) |
| Filter: ((shipping_date >= '2022-05-01'::date) AND (shipping_date <= '2022-05-01'::date)) |
| Rows Removed by Filter: 2000000 |
| Planning Time: 0.570 ms |
| Execution Time: 356.174 ms |
EXPLAIN