Heroku行数不正确 [英] Heroku Row Count Incorrect
问题描述
我不明白这是怎么回事,因为我的应用程序已经使用了heroku,并且今天它已经关闭了,因为行数已经超过了10,000行。尽管如此,因为rails告诉我在db中只有大约2000条记录。
运行pg:info,我看到以下内容:
计划:开发
状态:可用
连接:1
PG版本:9.1.5
创建日期:2012-09-25 03:12 UTC
数据大小:11.0 MB
表格:9
行数:15686/10000(写入权限被撤销)
分叉/关注:不可用
任何人都可以向我解释,尽管数据库中只有2,000条记录,但我似乎拥有15,000行?
谢谢!
仅靠Rails是不够的。 Heroku有一个很好的SQL控制台,您可以访问它:
heroku pg:psql YOUR_DB_URL
$ c $然后你可以编写这个查询来获得每个表的记录等级:
$ $ p
$ p> SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
如果您只需要更新的数字。可以使用
SELECT sum(n_live_tup)FROM pg_stat_user_tables;
请注意,您可以在您的配置中同时安装新的开发计划数据库和旧的共享数据库通过 heroku pg:info
)访问它。
允许在任何sql 顺着> //heroku.comrel =noreferrer> http://heroku.com 在我的情况下更新了正确的数字。在我的SQL查询期间。可能是heroku toolbelt控制台更新,速度较慢。 I've been using heroku for one of my applications and it got shutdown today because the row count has exceeded 10,000 rows. I don't understanding how this figure is arrived at though, as rails tells me I only have around 2000 records in the db. Running a pg:info, I see the following: Can anyone explain to me how I seem to have 15,000 rows despite only have 2,000 records in the database? Thanks! Rails alone is not enough. Heroku has a nice SQL console that you can access with: then you can write this query to obtain a rank of records per table: If you need only the updated num. of rows, you can use Please note that you can have both the new dev plan db and the old SHARED one in your config (access it by Allow a 30 mins delay between any sql BTW the web console on http://heroku.com in my case was updated with the correct num. during my sql queries. May be heroku toolbelt console updates, are slower. 这篇关于Heroku行数不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! truncate $ c之间延迟30分钟
Plan: Dev
Status: available
Connections: 1
PG Version: 9.1.5
Created: 2012-09-25 03:12 UTC
Data Size: 11.0 MB
Tables: 9
Rows: 15686/10000 (Write access revoked)
Fork/Follow: Unavailable
heroku pg:psql YOUR_DB_URL
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
SELECT sum(n_live_tup) FROM pg_stat_user_tables;
heroku pg:info
). You have to insert the correct db url, probably the one with a color.truncate
and the Rows
count to update.