简体   繁体   English

访问大型SQL表的直通查询

[英]Acces passthrough query for large sql table

I have a large table in a mysql database (6 million records). 我在mysql数据库中有一个大表(600万条记录)。 If I link the table, I can open it just fine--it seems like access requests the records as needed. 如果链接表,则可以很好地打开它-好像访问会根据需要请求记录。 However, if I use a passthrough query, it seems like access requests the entire table before opening it. 但是,如果我使用传递查询,则好像访问会在打开表之前请求整个表。 This is slow enough on my normal tables (200,000) records, but the big ones are impossible. 这在我的普通表(200,000)记录上足够慢,但是大记录是不可能的。 I want to use a passthrough to be able to use sql statements, but I need to make it faster. 我想使用传递来使用sql语句,但是我需要使其更快。 Is there a way to do this? 有没有办法做到这一点? Thanks! 谢谢!

EDIT: Here is the query; 编辑:这是查询; you can't get much simpler than this. 您无法比这更简单。 SELECT * FROM Traffic12

Your query is asking for the ENTIRE table. 您的查询要求输入ENTIRE表。 Access is doing exactly what you're telling it to do. Access确实在执行您要执行的操作。 The only times to use a pass-through query are when you want the WHERE clause (the filtering) to be executed on the server or the joins to be made on the server or when you are taking advantage of server-side functionality (such as a UDF) or when you want to add "hinting" that the back-end server will understand. 仅当您希望在服务器上执行WHERE子句(过滤)或在服务器上进行联接时,或者在利用服务器端功能(例如, UDF),或者当您想添加后端服务器可以理解的“提示”时。

The apparent performance benefit you notice when not using a pt query comes from Access fetching only a certain number of rows at a time; 您注意到,当不使用pt查询时,明显的性能优势来自Access一次仅获取一定数量的行; but you're bypassing this optimization from the paging algorithm when you use pass-thru. 但是当您使用直通时,您会从分页算法中绕过此优化。

When the filtering is done server-side a pass-thru query can be much more parsimonious with bandwidth than non-pt and can therefore yield large performance gains relative to non-pass-thru. 当在服务器端完成过滤时,直通查询在带宽方面比非直通查询更为简化,因此相对于非直通而言,可以获得较大的性能提升。 Or sometimes the back-end is a humongous 4-CPU machine with immense amounts of RAM and can churn through large indexes in a flash. 有时后端是一台庞大的4-CPU计算机,具有大量的RAM,并且可以在闪存中快速浏览大型索引。 You have to assess the situation to see what approach is better taking all factors into account. 您必须评估情况以了解哪种方法更好地考虑了所有因素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM