Re: [PATCH] psql: add \dcs to list all constraints

From: Tatsuro Yamada <yamatattsu(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] psql: add \dcs to list all constraints
Date: 2026-01-19 13:44:01
Message-ID: CAOKkKFuaFv1QiWRTiAzFpwwg7+R_QvjJNuLedhzApWut9Rk5iQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Álvaro, and ALL,

>I tested this with one million entries, and the query you proposed was
>more than 1,000 times faster.

Sorry, I just realized that I accidentally added an unnecessary filter
condition to one of the queries.
Specifically, the extra condition was:
AND n.nspname LIKE 'many_cns'

Because of this, I was not able to measure the two queries under identical
conditions. I will rerun the benchmarks and share the updated results
tomorrow.

> # Summary
> > The following changes are planned for the next patch:
> >
> > - Changed the query (using UNION ALL)
> > - Changed the columns and their order (and the sort order accordingly):
> > - Schema | Table | Type | Name | Definition
> > - Toggle definition verbosity with the + option
> > - Added a test case: \dCN cust*.order*
> >
> > The following items will not be included for now (as they are not
> critical):
> >
> > - Option to switch sort order
> > (e.g., sort by constraint name vs. table name)
> > - Improved command name checking logic
>
> Yeah, that sounds good to me.
>

Hopefully, I will also be able to submit a new patch along with the revised
measurement results tomorrow.

Regards,
Tatsuro Yamada

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-01-19 13:48:20 Re: Row pattern recognition
Previous Message Peter Eisentraut 2026-01-19 13:37:43 Re: SQL:2011 Application Time Update & Delete