2015-10-21
- jennifer
- martym
** Find commmonly accessed tables and their use of indexes: | |
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct; | |
Returns output like: | |
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct | |
----------------------+--------------+---------------+------------------------ | |
schema_migrations | 817 | 0 | 0.00000000000000000000 | |
user_device_photos | 349 | 0 | 0.00000000000000000000 |
First, check your current config (example output in `homebrew.mxcl.postgresql.plist.xml` lower down in this gist): | |
cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
Most importantly, note the `-D /usr/local/var/postgres` argument. | |
Second, shut down your current PostgreSQL. | |
brew services stop postgresql |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |