Heroku 行计数不正确

编程入门 行业动态 更新时间:2024-10-24 21:30:38
本文介绍了Heroku 行计数不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在为我的一个应用程序使用 heroku,但今天它关闭了,因为行数已超过 10,000 行.

I've been using heroku for one of my applications and it got shutdown today because the row count has exceeded 10,000 rows.

我不明白这个数字是如何得出的,因为 rails 告诉我我在数据库中只有大约 2000 条记录.

I don't understanding how this figure is arrived at though, as rails tells me I only have around 2000 records in the db.

运行 pg:info,我看到以下内容:

Running a pg:info, I see the following:

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

谁能向我解释一下,尽管数据库中只有 2,000 条记录,但我似乎有 15,000 行?

Can anyone explain to me how I seem to have 15,000 rows despite only have 2,000 records in the database?

谢谢!

推荐答案

仅靠 Rails 是不够的.Heroku 有一个不错的 SQL 控制台,您可以通过以下方式访问:

Rails alone is not enough. Heroku has a nice SQL console that you can access with:

heroku pg:psql YOUR_DB_URL

然后您可以编写此查询来获取每个表的记录排名:

then you can write this query to obtain a rank of records per table:

SELECT schemaname,relname,n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC;

如果您只需要更新的数字.行数,您可以使用

If you need only the updated num. of rows, you can use

SELECT sum(n_live_tup) FROM pg_stat_user_tables;

请注意,您可以在配置中同时拥有新的开发计划数据库和旧的 SHARED 数据库(通过 heroku pg:info 访问它).您必须插入正确的 db url,可能是带有颜色的那个.

Please note that you can have both the new dev plan db and the old SHARED one in your config (access it by heroku pg:info). You have to insert the correct db url, probably the one with a color.

在任何 sql truncate 和 Rows 计数之间允许 30 分钟的延迟更新.

Allow a 30 mins delay between any sql truncate and the Rows count to update.

顺便说一句,heroku 上的网络控制台在我的情况下已更新为正确的编号.在我的 sql 查询期间.可能是 heroku toolbelt 控制台更新,速度较慢.

BTW the web console on heroku in my case was updated with the correct num. during my sql queries. May be heroku toolbelt console updates, are slower.

更多推荐

Heroku 行计数不正确

本文发布于:2023-10-30 19:05:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1543727.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不正确   Heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!