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 sf1
("calendardate" varchar(10), "ticker" varchar(4), "revenueusd" int);
INSERT INTO sf1
("calendardate", "ticker", "revenueusd")
VALUES
('12/2021', 'DIS', '218190'),
('12/2021', 'ADBE', '41100'),
('12/2021', 'AAPL', '1239450'),
('03/2022', 'AAPL', '972780'),
('03/2022', 'DIS', '192490'),
('03/2022', 'ADBE', '42620'),
('06/2022', 'ADBE', '43860'),
('06/2022', 'AAPL', '829590'),
('06/2022', 'DIS', '215040')
CREATE TABLE
INSERT 0 9
SELECT
calendardate,
ticker,
revenueusd
FROM
sf1
ORDER BY calendardate ASC
calendardate | ticker | revenueusd |
---|---|---|
03/2022 | AAPL | 972780 |
03/2022 | ADBE | 42620 |
03/2022 | DIS | 192490 |
06/2022 | DIS | 215040 |
06/2022 | ADBE | 43860 |
06/2022 | AAPL | 829590 |
12/2021 | DIS | 218190 |
12/2021 | AAPL | 1239450 |
12/2021 | ADBE | 41100 |
SELECT 9