By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE
task_id | order_id | user_id | expire_time | status |
---|---|---|---|---|
50 | 80 | 1 | 2024-03-01 11:52:44 | -1 |
51 | 81 | 1 | 2024-03-01 16:00:44 | -1 |
52 | 80 | 2 | 2024-04-19 12:31:22 | 0 |
53 | 81 | 4 | 2024-03-01 16:52:44 | -1 |
54 | 81 | 6 | 2024-03-01 16:51:44 | -1 |
INSERT 0 5
CREATE TABLE
id | order_id | amount_to_reactivate |
---|---|---|
100 | 80 | 3 |
101 | 81 | 2 |
INSERT 0 2
task_id | order_id | user_id | expire_time | status | id | order_id | amount_to_reactivate | task_id |
---|---|---|---|---|---|---|---|---|
50 | 80 | 1 | 2024-03-22 02:47:10.113596 | 0 | 100 | 80 | 3 | 50 |
51 | 81 | 1 | 2024-03-22 02:47:10.113596 | 0 | 101 | 81 | 2 | 51 |
54 | 81 | 6 | 2024-03-22 02:47:10.113596 | 0 | 101 | 81 | 2 | 54 |
UPDATE 3
task_id | order_id | user_id | expire_time | status |
---|---|---|---|---|
50 | 80 | 1 | 2024-03-22 02:47:10.113596 | 0 |
51 | 81 | 1 | 2024-03-22 02:47:10.113596 | 0 |
52 | 80 | 2 | 2024-04-19 12:31:22 | 0 |
53 | 81 | 4 | 2024-03-01 16:52:44 | -1 |
54 | 81 | 6 | 2024-03-22 02:47:10.113596 | 0 |
SELECT 5