0

When we run the show command, e.g. show table db.tablename; show view db.viewname, it lists the object definition. I believe it will query the dictionary tables and rebuild .

Could you help us to understand how it queries the internal tables?

2
  • Show what, exactly? Is this the CLI client? I've never heard of a SHOW or DESCRIBE that rebulids anything. I think that PostgreSQL's client has an option that lets you do something like this. Please give the (exact) command you are running and the result yiu hope to obtain.
    – Vérace
    Commented Jun 9, 2018 at 11:03
  • When we use show command to get the DDL of the object. ex: show table db.tablename; show view db.viewname; I am trying to understand how show table results the DDL and what tables it is querying to get the output.
    – user153083
    Commented Jun 11, 2018 at 4:38

1 Answer 1

1

For a SHOW TABLE the parser actually creates the CREATE TABLE based on the current definition.

But for SHOW VIEW, etc. it's retrieving the CREATE from dbc.TablesV.RequestText. If the source code is larger than 12.5 KB RequestTxtOverFlow is set and the remainder is found in one or more 32 KB chunks in dbc.TextTbl.

For SHOW PROCEDURE it's different, this returns the internally stored sorce code (unless the SP is created with the NOSPL option), there's no way to access this info using a Select.

2
  • Thanks for the answer. For Requesttext column in dbc.tablesv for views and dbc.tvm for tables returns the text of the most recent data definition statement If you perform alter on view or table at that time requesttext column returns alter statement.show command still shows the DDL instead of alter. It will considers the data of requesttext column and does some internal operations / manipulations on dictionary tables and gets the data. Not sure how exactly it works.
    – user153083
    Commented Jun 11, 2018 at 4:32
  • As I wrote: for Tables the parser creates the DDL (this info is returned by the Resolver accessing the metadata stored in the Table Header on each AMP), but for views, etc. it's in RequestText.
    – dnoeth
    Commented Jun 11, 2018 at 5:57

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.