对 Heroku 的 PG 数据库最大大小感到困惑



当我运行heroku pg:info时,我会看到以下内容:

=== HEROKU_POSTGRESQL_RED_URL (DATABASE_URL)
Plan:        Dev
Status:      available
Connections: 5
PG Version:  9.2.4
Created:     2013-06-17 14:38 UTC
Data Size:   9.1 MB
Tables:      4
Rows:        9662/10000 (In compliance, close to row limit)
Fork/Follow: Unsupported

我怎么能看到那些排在哪里?我的意思是,如果我统计我所有的模型,我只得到4000行,而我看不到其他的在哪里。有办法在Heroku中获得更多的细节吗?

您可以运行此查询(取自Understanding Postgres Performance)。

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;

它也作为pg:index_usage包含在pg extrass插件中。

我建议使用外部工具(如pgAdmin)连接到数据库。

您可以使用检索数据库信息

$ heroku pg:credentials DATABASE

最新更新