How to master the tips of PostgreSQL
This article mainly explains "how to master the tips of PostgreSQL". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to master the tips of PostgreSQL".
Here are some useful tips:
In psql, tag your queries and use Ctrl+R
[local]: 5432 pg12@testdb=# select * from T1 limit 1; id | C1 | c2-+-4 | 4 | 4 (1 row) Time: 1.872 ms [local]: 5432 pg12@testdb=# select * from test limit 1 / error: relation "test" does not existLINE 1: select * from test limit 1; ^ Time: 0.996 ms [local]: 5432 pg12@testdb=# create table test (id int) CREATE TABLETime: 6.019 ms [local]: 5432 pg12@testdb=# insert into test values (1); INSERT 0 1Time: 2.310 ms [local]: 5432 pg12@testdb=# insert into test values (2); INSERT 0 1Time: 2.409 ms
At this time, use the shortcut key Ctrl + R, display the search box, type T1 Personpsql to retrieve T1-related sql and display it on the interface.
(reverse-i-search) `': (reverse-i-search) `t1clients: select * from T1 limit 1
Better psql output
\ x is not powerful enough to use pspg.
Get a stack trace for an error
Use gdb to set breakpoints on errfinish to track errors
[local]: 5432 pg12@testdb=# SELECT pg_backend_pid (); pg_backend_pid-1538 (1 row)... (gdb) b errfinishBreakpoint 1 at 0xa65517: file elog.c, line 412. (gdb) cContinuing.
If an execution error occurs, it will be stopped in gdb, and the call stack can be printed using bt.
Thank you for your reading, the above is the content of "how to master the tips of PostgreSQL", after the study of this article, I believe you have a deeper understanding of how to master the tips of PostgreSQL, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!