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?.
SELECT 2
CREATE FUNCTION
ERROR: column "SELECT date_trunc('hour', event_at), id, " does not exist LINE 1: format("SELECT date_trunc('hour', event_at), ^ QUERY: format("SELECT date_trunc('hour', event_at), id, code, is_test FROM metric_events_%s event_at < date_trunc('hour', NOW() - interval '1 hour') != 0", part_id) CONTEXT: PL/pgSQL function my_query(integer) line 3 during statement block local variable initialization
CREATE FUNCTION
event_at | id | code | is_test |
---|---|---|---|
2024-04-08 06:00:00+00 | 1 | code1 | f |
2024-04-08 07:00:00+00 | 2 | code2 | f |
SELECT 2
CREATE TABLE
ALTER TABLE
tableoid | event_at | id | code | is_test |
---|---|---|---|---|
metric_events_1 | 2024-04-08 06:54:11.769316+00 | 1 | code1 | f |
metric_events_1 | 2024-04-08 07:54:11.769422+00 | 2 | code2 | f |
SELECT 2
?column? |
---|
2024-04-08 04:54:11.78998+00 |
SELECT 1
ERROR: invalid input syntax for type timestamp with time zone: "5h" LINE 2: select now()-'5h'; ^
Name | Left arg type | Right arg type | Result type |
---|---|---|---|
+ | timestamp without time zone | interval | timestamp without time zone |
- | timestamp without time zone | interval | timestamp without time zone |
- | timestamp without time zone | timestamp without time zone | interval |
SELECT 3