Skip to content

Instantly share code, notes, and snippets.

@sibson
Last active November 4, 2015 04:09
Show Gist options
  • Save sibson/9ffcbe309b6ef383b09a to your computer and use it in GitHub Desktop.
Save sibson/9ffcbe309b6ef383b09a to your computer and use it in GitHub Desktop.
> h pg:diagnose -a campgrounddemo
Report 1544d87c-b8ea-445d-976c-81d0a8279c0a for campgrounddemo::DATABASE_URL
available for one month after creation on 2015-11-03 23:52:22.85383+00
RED: Hit Rate
Name Ratio
----------------------------------- ------------------
overall index hit rate 0.8686475184695037
overall cache hit rate 0.7648839967012158
campgrounddemo._trigger_log 0.9835142910600523
campgrounddemo._trigger_log_archive 0.5361412398068245
campgrounddemo.contact 0.798884059490808
campgrounddemo.account 0.7975259387100297
YELLOW: Indexes
Reason Index Index Scan Pct Scans Per Write Index Size Table Size
---------------------- ------------------------------------------------------------------------ -------------- --------------- ---------- ----------
Low Scans, High Writes campgrounddemo._trigger_log_archive::_trigger_log_archive_idx_record_id 0.08 0.00 100 MB 1738 MB
Low Scans, High Writes campgrounddemo._trigger_log_archive::_trigger_log_archive_idx_created_at 1.50 0.00 100 MB 1738 MB
GREEN: Connection Count
GREEN: Long Queries
GREEN: Idle in Transaction
GREEN: Bloat
GREEN: Blocking Queries
GREEN: Load
> h pg:unused-indexes -a campgrounddemo
table | index | index_size | index_scans
-------------------------------------+-------------------------------------------+------------+-------------
campgrounddemo.contact | contact_idx_accountid | 59 MB | 0
campgrounddemo.contact | contact_idx_account2__c | 59 MB | 0
campgrounddemo._trigger_log_archive | _trigger_log_archive_idx_state_table_name | 35 MB | 0
campgrounddemo._trigger_log_archive | _trigger_log_archive_idx_record_id | 100 MB | 10
(4 rows)
> h pg:index-size -a campgrounddemo
name | size
-------------------------------------------+------------
_trigger_log_archive_pkey | 162 MB
_trigger_log_archive_idx_record_id | 97 MB
_trigger_log_archive_idx_created_at | 97 MB
contact_idx_systemmodstamp | 62 MB
contact_idx_account2__c | 59 MB
contact_idx_accountid | 59 MB
account_idx_extid__c | 53 MB
_trigger_log_pkey | 51 MB
account_idx_systemmodstamp | 51 MB
contact_idx_sfid | 49 MB
account_idx_sfid | 48 MB
_trigger_log_archive_idx_state_table_name | 34 MB
contact_pkey | 22 MB
account_pkey | 22 MB
_trigger_log_idx_created_at | 10 MB
_trigger_log_idx_state_id | 8216 kB
_trigger_log_idx_state_table_name | 1512 kB
Apps_pkey | 24 kB
idx__sf_event_log_comp_key | 8192 bytes
case_pkey | 8192 bytes
case_idx_systemmodstamp | 8192 bytes
_hcmeta_pkey | 8192 bytes
lead_pkey | 8192 bytes
_sf_event_log_pkey | 8192 bytes
idx__sf_event_log_sfid | 8192 bytes
lead_idx_sfid | 8192 bytes
case_idx_sfid | 8192 bytes
opportunity_idx_sfid | 8192 bytes
opportunity_idx_systemmodstamp | 8192 bytes
lead_idx_systemmodstamp | 8192 bytes
opportunity_pkey | 8192 bytes
(31 rows
> h pg:diagnose -a campgrounddemo
Report ec159c5d-709b-4994-a6ab-5b514543455d for campgrounddemo::DATABASE_URL
available for one month after creation on 2015-11-02 23:29:16.661688+00
RED: Hit Rate
Name Ratio
----------------------------------- ------------------
overall index hit rate 0.8994334592866684
overall cache hit rate 0.7656055082737881
campgrounddemo._trigger_log 0.9879425644463627
campgrounddemo._trigger_log_archive 0.6034552845528456
campgrounddemo.contact 0.7988733272080333
campgrounddemo.account 0.7975920975352171
YELLOW: Indexes
Reason Index Index Scan Pct Scans Per Write Index Size Table Size
---------------------- ------------------------------------------------------------------------------ -------------- --------------- ---------- ----------
Low Scans, High Writes campgrounddemo._trigger_log_archive::_trigger_log_archive_table_name_state_idx 0.01 0.00 233 MB 1738 MB
GREEN: Connection Count
GREEN: Long Queries
GREEN: Idle in Transaction
GREEN: Bloat
GREEN: Blocking Queries
GREEN: Load
> h pg:unused-indexes -a campgrounddemo
table | index | index_size | index_scans
-------------------------------------+-------------------------------------------+------------+-------------
campgrounddemo.contact | contact_idx_accountid | 58 MB | 0
campgrounddemo.contact | contact_idx_account2__c | 58 MB | 0
campgrounddemo._trigger_log_archive | _trigger_log_archive_table_name_state_idx | 233 MB | 1
(3 rows)
> h pg:index-size -a campgrounddemo
name | size
----------------------------------------------+------------
_trigger_log_archive_state_id_created_at_idx | 337 MB
_trigger_log_archive_table_name_state_idx | 233 MB
_trigger_log_archive_pkey | 162 MB
idx__trigger_log_comp_key | 75 MB
contact_idx_systemmodstamp | 61 MB
contact_idx_accountid | 58 MB
contact_idx_account2__c | 58 MB
idx__trigger_log_name_state | 54 MB
account_idx_extid__c | 52 MB
_trigger_log_pkey | 51 MB
account_idx_systemmodstamp | 50 MB
contact_idx_sfid | 49 MB
account_idx_sfid | 47 MB
contact_pkey | 22 MB
account_pkey | 22 MB
Apps_pkey | 24 kB
case_pkey | 8192 bytes
case_idx_systemmodstamp | 8192 bytes
_hcmeta_pkey | 8192 bytes
_sf_event_log_pkey | 8192 bytes
case_idx_sfid | 8192 bytes
opportunity_idx_sfid | 8192 bytes
idx__sf_event_log_sfid | 8192 bytes
lead_idx_systemmodstamp | 8192 bytes
lead_pkey | 8192 bytes
opportunity_idx_systemmodstamp | 8192 bytes
opportunity_pkey | 8192 bytes
lead_idx_sfid | 8192 bytes
idx__sf_event_log_comp_key | 8192 bytes
(29 rows)
<connect> (M=da7db) herokuconnect
> h pg:index-usage -a campgrounddemo
relname | percent_of_times_index_used | rows_in_table
----------------------+-----------------------------+---------------
_trigger_log_archive | 60 | 3977881
contact | 79 | 881399
account | 79 | 878257
_trigger_log | 98 | 149016
case | 18 | 5
opportunity | 74 | 5
lead | Insufficient data | 4
Apps | Insufficient data | 3
Apps | Insufficient data | 3
_hcmeta | 0 | 1
_trigger_last_id | | 1
_sf_event_log | 34 | 0
(12 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment