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?.
10 rows affected
createdate | id | stock |
---|---|---|
2021-07-30 | 1 | 10 |
2021-08-01 | 1 | 55 |
2021-08-02 | 1 | 75 |
2021-08-03 | 1 | 20 |
2021-08-04 | 1 | 5 |
2021-08-05 | 1 | 0 |
2021-07-25 | 2 | 110 |
2021-08-01 | 2 | 255 |
2021-08-02 | 2 | 375 |
2021-07-20 | 3 | 500 |
9 rows affected
id | qtyin | qtyout | createdate |
---|---|---|---|
1 | 0 | 0 | 2021-07-30 |
1 | 45 | 0 | 2021-08-01 |
1 | 20 | 0 | 2021-08-02 |
1 | 0 | 55 | 2021-08-03 |
1 | 0 | 15 | 2021-08-04 |
1 | 0 | 0 | 2021-08-05 |
2 | 0 | 0 | 2021-07-25 |
2 | 145 | 0 | 2021-08-01 |
2 | 120 | 0 | 2021-08-02 |
id | 最後異動日期 | 最後異動日期庫存 | in | out | 庫存 |
---|---|---|---|---|---|
1 | 2021-07-30 | 10 | 65 | 70 | 5 |
2 | 2021-07-25 | 110 | 265 | 0 | 375 |
3 | 2021-07-20 | 500 | 0 | 0 | 500 |