Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sharing of sql statements commonly used in postgresql

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "sharing sql sentences commonly used in postgresql". In daily operation, I believe many people have doubts about sharing sql sentences commonly used in postgresql. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "sharing sql sentences commonly used in postgresql". Next, please follow the editor to study!

Sql statement

15 commonly used statements:

1.select relname,relpages from pg_class order by relpages desc

2.selecr pg_database_size ('database name')

3.select pg_size_pretty (pg_total_relation_size ('table name'))

4.\ d Table name

5.create index name on table using index_type (colum)

6.rollback,commit

7.explain query

8.explain analyze query

9.insert into number (num) values (generate_series (11991000))

10.select count (*) from table, select count (col_name) from table

Select count (distinct column name) from table

11.slect MAX (num) from number_table where num

< (select MAX(num) from number_table) 12.select MIN(col_name) from number_table where num >

(select MIN (num) from number_table)

13.select typname,typlen from pg_type where typtype ='b'

14.\ g output_file,select * from table_name,\ g

15. Encryption: select crypt ('sathiys',gen_salt (' md5'))

16.insert into WU (A1 ~ B1) select generate_series (1 ~ ~ 1000000), 'aa'

17.select name,setting,short_desc from pg_settings where name like'% scan'

At this point, the study of "sharing sql sentences commonly used in postgresql" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report