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
CREATE INDEX
INSERT 0 1
CREATE TABLE
INSERT 0 1
table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | character_octet_length | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | domain_catalog | domain_schema | domain_name | udt_catalog | udt_schema | udt_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier | is_self_referencing | is_identity | identity_generation | identity_start | identity_increment | identity_maximum | identity_minimum | identity_cycle | is_generated | generation_expression | is_updatable |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
postgres | public | log | logid | 1 | nextval('log_logid_seq'::regclass) | NO | integer | null | null | 32 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int4 | null | null | null | null | 1 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
postgres | public | log | jobid | 2 | null | NO | integer | null | null | 32 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int4 | null | null | null | null | 2 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
postgres | public | log | time | 3 | null | YES | timestamp without time zone | null | null | null | null | null | 6 | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | timestamp | null | null | null | null | 3 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
postgres | public | log | logtext | 4 | null | NO | text | null | 1073741824 | null | null | null | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | text | null | null | null | null | 4 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
SELECT 4
ALTER TABLE
pg_get_serial_sequence |
---|
public.log_logid_seq |
SELECT 1
ALTER TABLE
seqrelid | seqtypid | seqstart | seqincrement | seqmax | seqmin | seqcache | seqcycle |
---|---|---|---|---|---|---|---|
16384 | 23 | 1 | 1 | 2147483647 | 1 | 1 | f |
16394 | 20 | 1 | 1 | 9223372036854775807 | 1 | 1 | f |
SELECT 2
table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | character_octet_length | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | domain_catalog | domain_schema | domain_name | udt_catalog | udt_schema | udt_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier | is_self_referencing | is_identity | identity_generation | identity_start | identity_increment | identity_maximum | identity_minimum | identity_cycle | is_generated | generation_expression | is_updatable |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
postgres | public | linked_to_log | id | 1 | null | NO | bigint | null | null | 64 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int8 | null | null | null | null | 1 | NO | YES | BY DEFAULT | 1 | 1 | 9223372036854775807 | 1 | NO | NEVER | null | YES |
postgres | public | linked_to_log | logid | 2 | null | YES | bigint | null | null | 64 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int8 | null | null | null | null | 2 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
SELECT 2
ALTER SEQUENCE
table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length | character_octet_length | numeric_precision | numeric_precision_radix | numeric_scale | datetime_precision | interval_type | interval_precision | character_set_catalog | character_set_schema | character_set_name | collation_catalog | collation_schema | collation_name | domain_catalog | domain_schema | domain_name | udt_catalog | udt_schema | udt_name | scope_catalog | scope_schema | scope_name | maximum_cardinality | dtd_identifier | is_self_referencing | is_identity | identity_generation | identity_start | identity_increment | identity_maximum | identity_minimum | identity_cycle | is_generated | generation_expression | is_updatable |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
postgres | public | linked_to_log | id | 1 | null | NO | bigint | null | null | 64 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int8 | null | null | null | null | 1 | NO | YES | BY DEFAULT | 1 | 1 | 9223372036854775807 | 1 | NO | NEVER | null | YES |
postgres | public | linked_to_log | logid | 2 | null | YES | bigint | null | null | 64 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | postgres | pg_catalog | int8 | null | null | null | null | 2 | NO | NO | null | null | null | null | null | NO | NEVER | null | YES |
SELECT 2