2

I wish to examine contents of a btree index.

However each of pageinspect's btree functions says "channel_status_pkey_index" is not a btree index

Table looks like this:

CREATE TABLE public.channel_status (
    partition_id int2 NOT NULL,
    game public."game" NOT NULL,
    channel_id int4 NOT NULL,
    platform_partition int4 NOT NULL,
    enabled bool NOT NULL,
    modified timestamptz NOT NULL,
    CONSTRAINT channel_status_pkey PRIMARY KEY (partition_id, game, channel_id, platform_partition)
)
PARTITION BY LIST (partition_id);

It automatically creates btree index on primary key. I also created explicit index

CREATE UNIQUE INDEX channel_status_pkey_index ON ONLY public.channel_status USING btree (partition_id, game, channel_id, platform_partition)

But if I run any btree function, it fails, no matter if I use channel_status_pkey or channel_status_pkey_index, with `public.' prefix or without:

#  SELECT * FROM bt_metap('public.channel_status_pkey_index');
ERROR:  "channel_status_pkey_index" is not a btree index

Do you have an idea, why postgres states, that btree index is not a btree index?

1 Answer 1

4

Because it is a partitioned index, not a regular index.

Similar to partitioned tables, partitioned indexes don't hold any data, so it would not make sense to use them with pageinspect's functions. The actual index data are held in the partitions of the index, which are indexes on the table partitions. You should use the pageinspect functions with those index partitions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.