By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 3
CREATE INDEX
SET
| QUERY PLAN |
|---|
| Index Scan using tbl_x_y_idx on tbl (cost=0.13..12.18 rows=3 width=12) |
EXPLAIN
| QUERY PLAN |
|---|
| Incremental Sort (cost=4.15..12.31 rows=3 width=12) |
| Sort Key: x, y DESC |
| Presorted Key: x |
| -> Index Scan using tbl_x_y_idx on tbl (cost=0.13..12.18 rows=3 width=12) |
EXPLAIN
| QUERY PLAN |
|---|
| Index Scan using tbl_x_y_idx on tbl (cost=0.13..8.15 rows=1 width=12) |
| Index Cond: (x = 999) |
EXPLAIN
| QUERY PLAN |
|---|
| Index Scan Backward using tbl_x_y_idx on tbl (cost=0.13..8.15 rows=1 width=12) |
| Index Cond: (x = 999) |
EXPLAIN