MySQL View is faster or not for querying from DB that containd 40 million data [closed]

烂漫一生 提交于 2019-12-06 16:29:16

问题


I have a table that contains 40 million data. I want to reduce the query time. is it possible to do it using views?. if yes, could you please explain how?.


回答1:


Yes, It is possible to reduce query time using view because it have clustered index assigned and they'll store temporary result that can speed up resulting queries.




回答2:


Well, the MySQL statement for creating a view is:

CREATE ALGORITHM = MERGE VIEW my_view AS
SELECT ...

Where the algorithm is one of MERGE, TEMPTABLE, or UNDEFINED.

However, as always the answer to how to increase performance is, "it depends". We really need more details on the table structure (columns and types), current indices, how often the table rows get updated, how often new rows get inserted, and what kind of data is stored in the table in order to make an educated guess on how to improve performance.



来源:https://stackoverflow.com/questions/23863546/mysql-view-is-faster-or-not-for-querying-from-db-that-containd-40-million-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!