$ scp source_file_path destination_file_path
Single file
| -- Table information like sortkeys, unsorted percentage | |
| -- see http://docs.aws.amazon.com/redshift/latest/dg/r_SVV_TABLE_INFO.html | |
| SELECT * FROM svv_table_info; | |
| -- Table sizes in GB | |
| SELECT t.name, COUNT(tbl) / 1000.0 AS gb | |
| FROM ( | |
| SELECT DISTINCT datname, id, name | |
| FROM stv_tbl_perm | |
| JOIN pg_database ON pg_database.oid = db_id |
| import gzip | |
| import io | |
| def gzip_str(string_): | |
| out = io.BytesIO() | |
| with gzip.GzipFile(fileobj=out, mode='w') as fo: | |
| fo.write(string_.encode()) | |
| bytes_obj = out.getvalue() |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)| javascript:(function() { | |
| function copyToClipboard(text) { | |
| if (window.clipboardData && window.clipboardData.setData) { | |
| /*IE specific code path to prevent textarea being shown while dialog is visible.*/ | |
| return clipboardData.setData("Text", text); | |
| } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { | |
| var textarea = document.createElement("textarea"); | |
| textarea.textContent = text; |
| /* | |
| Gmail bookmarklet | |
| rondevera.com | |
| For quickly e-mailing the current page's URL (and the selected text, if any) | |
| via Gmail. | |
| Usage: | |
| - Create a new item in your bookmark bar with the name "Gmail" (or just "Gm", | |
| or your favorite Unicode character), and the code below as the location. |