Enhanced index details using \d in psql

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Enhanced index details using \d in psql
Date: 2001-11-08 15:08:24
Message-ID: 200111081508.KAA20984@granger.mail.mindspring.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've revised my patch to use the pg_get_indexdef function, as
suggested by Tom Lane. When doing a \d in psql, it shows not
only the name of the index, but which columns it uses,
what type of index it is (btree, hash, etc.), whether it
is unique or a primary key, and (thanks to the pg_get_indexdef
magic) information about functional and partial indexes.
I also made the ORDER BY stick the primary keys and unique
indexes at the top of the list, then alphabetasize the rest,
which I think is a good trade off for having ruined the
previous "separation" of the 3 types of indexes.

Here is some sample output:

CREATE TABLE PIZZA (
slicename VARCHAR(10) PRIMARY KEY,
crust VARCHAR(12),
topping INTEGER
);
CREATE INDEX banana ON pizza (crust);
CREATE UNIQUE INDEX watermelon ON pizza (topping);
CREATE INDEX apple ON pizza USING hash (topping) WHERE (topping > 99);
CREATE INDEX peach ON pizza (lower(crust));

bakery=# \d pizza

Table "pizza"
Column | Type | Modifiers
- -----------+-----------------------+-----------
slicename | character varying(10) | not null
crust | character varying(12) |
topping | integer |
Indexes: pizza_pkey primary key btree (slicename),
watermelon unique btree (topping),
apple hash (topping) WHERE (topping > 99),
banana btree (crust),
peach btree (lower(crust))

Greg Sabino Mullane
greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200111081007

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iQA/AwUBO+qfuLybkGcUlkrIEQKFNgCg0ycYPt5DMvXI8EH/CH2mc8ZOJYwAoK1x
RDPvYrxuU55Sp1UIYgTWCRdD
=VBAa
-----END PGP SIGNATURE-----

Attachment Content-Type Size
unknown_filename text/plain 6.0 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-11-08 15:57:24 Re: pgcrypto bug
Previous Message Ferdinand Smit 2001-11-08 14:09:16 Re: Query preformence