GP Database Notes-table structure query, table-occupied spatial query

Source: Internet
Author: User

The method of table structure query in GP database:

Select D.nspname

, Obj_description (d.oid)

, C.relname

, Obj_description (c.oid)

, A.attnum

, A.attname

, E.data_type

, Col_description (C.oid,a.attum)

, e.is_nullable

, case where E.data_type ~ ' character '

Then e.character_maximum_length| | ‘‘

where E.data_type ~ ' numeric '

Then ((' (' (' | | | E.numeric_precision) | | E.numeric_scale) | | ') '

Else '

End

From Pg_class

Left JOIN Pg_acctribute A

On a.atttypid = T.oid

Join Pg_namespace D

On d.oid = C.relnamespace

and d.nspname not like ' pg_% '

Join Information_schema.cloumns E

On c.relname = E.table_name::name

and A.attnum = E.ordinal_position

and e.table_schema::name = D.nspname

where C.relname!~ ' pg|prt '

and A.attnum > 0

ORDER BY D.nspname

, C.relname

, A.attnum

;


GP Database occupies table space

Select Pg_size_pretty (pg_relation_size (' schema_name.table_name '));

Select Pg_size_pretty (pg_database_size (' db_name '));

GP Database Notes-table structure query, table-occupied spatial query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.