Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- checkout=# explain analyze
- SELECT * FROM public.carts
- ORDER BY id DESC LIMIT 10;
- QUERY PLAN
- ----------------------------------------------------------------------------------------------------------------------------------------------
- Limit (cost=0.43..0.75 rows=10 width=16) (actual time=0.042..0.048 rows=10 loops=1)
- -> Index Scan Backward using carts_pkey on carts (cost=0.43..313740.34 rows=9999860 width=16) (actual time=0.041..0.044 rows=10 loops=1)
- Planning Time: 0.090 ms
- Execution Time: 0.066 ms
- (4 rows)
- Time: 0.507 ms
- checkout=# explain analyze select * from carts where id=9999990;
- QUERY PLAN
- -------------------------------------------------------------------------------------------------------------------
- Index Scan using carts_pkey on carts (cost=0.43..8.45 rows=1 width=16) (actual time=0.020..0.021 rows=1 loops=1)
- Index Cond: (id = 9999990)
- Planning Time: 0.102 ms
- Execution Time: 0.041 ms
- (4 rows)
- Time: 0.423 ms
- checkout=# explain analyze insert into carts values (10000001, 1301, 482314, 2);
- QUERY PLAN
- ----------------------------------------------------------------------------------------------
- Insert on carts (cost=0.00..0.01 rows=1 width=16) (actual time=0.179..0.179 rows=0 loops=1)
- -> Result (cost=0.00..0.01 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=1)
- Planning Time: 0.021 ms
- Trigger for constraint carts_productID_fkey: time=3.594 calls=1
- Execution Time: 3.831 ms
- (5 rows)
- Time: 6.013 ms
- checkout=# explain analyze DELETE from carts where id=9999990
- checkout-# ;
- QUERY PLAN
- ------------------------------------------------------------------------------------------------------------------------
- Delete on carts (cost=0.43..8.45 rows=1 width=6) (actual time=1.539..1.539 rows=0 loops=1)
- -> Index Scan using carts_pkey on carts (cost=0.43..8.45 rows=1 width=6) (actual time=0.040..0.043 rows=1 loops=1)
- Index Cond: (id = 9999990)
- Planning Time: 1.796 ms
- Execution Time: 1.610 ms
- (5 rows)
- Time: 4.228 ms
- checkout=# explain analyze UPDATE carts SET quantity=10 WHERE id=9999999;
- QUERY PLAN
- -------------------------------------------------------------------------------------------------------------------------
- Update on carts (cost=0.43..8.45 rows=1 width=22) (actual time=0.044..0.044 rows=0 loops=1)
- -> Index Scan using carts_pkey on carts (cost=0.43..8.45 rows=1 width=22) (actual time=0.021..0.023 rows=1 loops=1)
- Index Cond: (id = 9999999)
- Planning Time: 0.100 ms
- Execution Time: 0.097 ms
- (5 rows)
- Time: 1.435 ms
Add Comment
Please, Sign In to add comment