如何确定是否可以从展示次数表中删除某些索引 [英] How do I determine if I can delete some indexes from the impressions table

查看:143
本文介绍了如何确定是否可以从展示次数表中删除某些索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于Ruby on Rails的网站上的印象派宝石。我们的数据库是mysql。
印象表大约是2M记录,这对MySql没有任何问题。
表大小为800M,开始对我们的服务器征税。
表的数据大小为200M,索引大小为600M。大多数索引都是由gem预定义的。有没有办法弄清楚是否正在使用或可以删除​​这些索引?

I'm using the impressionist gem for a Ruby on Rails based website. Our database is mysql. The impressions table is at about 2M records, which should pose no problem for MySql. The table size is 800M which is beginning to tax our servers. The data size of the table is 200M and the index size is 600M. Most of the indexes were predefined by the gem. Is there a way to figure out if any of these indexes are being used or can be deleted?

1,310,855,040 controlleraction_session_index

1,310,855,040 controlleraction_session_index

1,310,855,040 controlleraction_ip_index

1,310,855,040 controlleraction_ip_index

1,310,855,040 controlleraction_request_index

1,310,855,040 controlleraction_request_index

- 880,757,504 poly_request_index

--880,757,504 poly_request_index

- 880,757,504 impressionable_type_message_index

--880,757,504 impressionable_type_message_index

- 880,757,504 poly_session_index

--880,757,504 poly_session_index

- 880,757,504 poly_ip_index

--880,757,504 poly_ip_index

----- 6,854,144 PRIMARY

-----6,854,144 PRIMARY

推荐答案

他们的README说:不报道......这件事只是创造了数据。

Their README says: "No reporting yet.. this thingy just creates the data."

创建索引以加快计数方法。

The indexes are created to speed up the count methods.

@widget.impressionist_count
@widget.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-05")

在这些方法中删除应用中未使用的所有字段的索引应该是安全的。

It should be safe to remove indexes for all fields that you don't use in your app in these methods.

注意:这个答案来自于阅读他们的源代码几分钟。我没有使用过宝石

这篇关于如何确定是否可以从展示次数表中删除某些索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆