Last active
December 17, 2015 03:59
-
-
Save andreacfm/5546993 to your computer and use it in GitHub Desktop.
SHELL AND SIMPLE SCRIPTS
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
SELECT | |
'cache hit rate' AS name, | |
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) AS ratio | |
FROM pg_statio_user_tables; | |
GO | |
SELECT | |
sum(idx_blks_read) as idx_read, | |
sum(idx_blks_hit) as idx_hit, | |
(sum(idx_blks_hit) - sum(idx_blks_read)) / sum(idx_blks_hit) as ratio | |
FROM | |
pg_statio_user_indexes; | |
GO | |
SELECT | |
relname, | |
100 * idx_scan / (seq_scan + idx_scan) percent_of_times_index_used, | |
n_live_tup rows_in_table | |
FROM | |
pg_stat_user_tables | |
WHERE | |
seq_scan + idx_scan > 0 | |
ORDER BY | |
n_live_tup DESC; |
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
SELECT cast((CAST(A.cntr_value1 AS NUMERIC) / CAST(B.cntr_value2 AS NUMERIC))*100 as decimal(10,2)) AS Buffer_Cache_Hit_Ratio | |
FROM ( | |
SELECT cntr_value AS cntr_value1 | |
FROM sys.dm_os_performance_counters | |
WHERE object_name = 'SQLServer:Buffer Manager' | |
AND counter_name = 'Buffer cache hit ratio' | |
) AS A, | |
( | |
SELECT cntr_value AS cntr_value2 | |
FROM sys.dm_os_performance_counters | |
WHERE object_name = 'SQLServer:Buffer Manager' | |
AND counter_name = 'Buffer cache hit ratio base' | |
) AS B |
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
# copy key | |
ssh-copy-id -i ~/.ssh/[key].pub [remote_host] | |
# permissions | |
sudo chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment