Description field for tables and views

2024-07-03 Thread Kent Dorfman
I think I already know the answer but asking here is probably quicker 
turnaround than researching it.


I've gotten into a "view bloat" scenario with many many custom views 
that I cannot remember what they actually do.  Is there any psql 
function/command to add a description field to a table or view 
definition in the system?  Would be nice to have a one line general text 
note capability to quickly see what a complicated view does when looking 
at the defintion via

# \dv+

Looks like the command has the field present, but not sure how to 
populate it.


am using PostgreSQL 13.xx in Debian.




Re: Description field for tables and views

2024-07-03 Thread Kent Dorfman

On 7/3/24 15:30, Christophe Pettus wrote:



On Jul 3, 2024, at 12:28, Kent Dorfman  wrote:

Is there any psql function/command to add a description field to a table or 
view definition in the system?

Allow me to introduce you to my good friend "COMMENT":

https://www.postgresql.org/docs/current/sql-comment.html

Thanks for the hint!

It's the simplest and most direct solution.  Been typing SQL for 40 
years and haven't had occasion to use COMMENT.  Is it SQL standard or 
postgres specific?  Am not a DBA by trade but an embedded systems guy.


Re: Design strategy for table with many attributes

2024-07-04 Thread Kent Dorfman

On 7/4/24 15:37, Lok P wrote:
Or say, what is the maximum number of columns per table we should 
restrict? Should we break the single transaction into multiple tables 
like one main table and other addenda tables with the same primary key 
to join and fetch the results wherever necessary?


900 columns makes my head hurt badly...

The neophyte will design a table with a separate field for each type of 
phone number that may be encountered.  The experienced designer will 
move all phone numbers to its own table, where each entry/row contains a 
reference link, a "number_type" field, and a field with the actual 
number in it...Three fields in a table that is manageable and can be 
queried/modified without stressing the database server.