在MySQL中是否可以有索引视图? [英] Is it possible to have an indexed view in MySQL?

查看:1199
本文介绍了在MySQL中是否可以有索引视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自2005年以来在MySQL论坛上发布的帖子,但是没有什么比这更新了.基于此,这是不可能的.但是在3-4年内会有很多变化.

I found a posting on the MySQL forums from 2005, but nothing more recent than that. Based on that, it's not possible. But a lot can change in 3-4 years.

我正在寻找的是一种在视图上建立索引但使被查看的表保持未建立索引的方法.索引会损害编写过程,并且该表的写入频率非常高(以至于索引会使所有内容减慢到爬网的速度).但是,缺少索引使我的查询非常缓慢.

What I'm looking for is a way to have an index over a view but have the table that is viewed remain unindexed. Indexing hurts the writing process and this table is written to quite frequently (to the point where indexing slows everything to a crawl). However, this lack of an index makes my queries painfully slow.

推荐答案

我认为MySQL不支持您需要的物化视图,但是在这种情况下它无济于事.无论索引是在视图上还是在基础表上,都需要在基础表的更新过程中的某个时刻对其进行写入和更新,因此仍然会导致写入速度问题.

I don't think MySQL supports materialized views which is what you would need, but it wouldn't help you in this situation anyway. Whether the index is on the view or on the underlying table, it would need to be written and updated at some point during an update of the underlying table, so it would still cause the write speed issues.

您最好的选择可能是创建摘要表,并定期对其进行更新.

Your best bet would probably be to create summary tables that get updated periodically.

这篇关于在MySQL中是否可以有索引视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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