-
-
Save nvdarekar/fdaf23249b7c35a69984 to your computer and use it in GitHub Desktop.
3 tips for a better PostgreSQL usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Use your editor to write queries: | |
| # Tell the terminal what editory to use | |
| $ export EDITOR=subl | |
| # Then in psql type: | |
| psql> \e | |
| # It will open SublimeText with the last query. | |
| # Close the file and the query will run. | |
| # 2. Turn too long columns into lines: | |
| psql> \x auto | |
| # Postgres will then use the most intelligible | |
| # way to display the records. | |
| # 3. Use \d to get info on anything. | |
| # Info about current database: | |
| psql> \d | |
| # More info about current database: | |
| psql> \d+ | |
| # Info about a table: | |
| psql> \d t_table_name | |
| # Info about functions: | |
| psql> \df | |
| # See about the 39 other \d commands with: | |
| psql> \? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment