简体   繁体   English

防止全表扫描简单查询

[英]Prevent full table scan simple query

Lately we been having a lot of problems with our mysql server i have been running some test with a profiler (JetProfiler) and a stresstester (loadUI).最近我们的 mysql 服务器出现了很多问题,我一直在使用分析器 (JetProfiler) 和压力测试器 (loadUI) 运行一些测试。 I have noticed that after having atleast 20 connections run with loudUI at same time it already makes it unable to connect or connect REALLY slow to the webpage.我注意到,在同时使用 loudUI 运行至少 20 个连接后,它已经无法连接或连接到网页的速度非常慢。 Jetprofiler says that prety much every query we run is bad since they all use full table scans, I'm wondering if this could actually be the problem. Jetprofiler 说几乎我们运行的每个查询都不好,因为它们都使用全表扫描,我想知道这是否真的是问题所在。

Here's a screenshot of a query that probably gets run the most:这是可能运行最多的查询的屏幕截图:

在此处输入图像描述

how would I improve this?我将如何改进这个?

Just create single indices for following columns: datum, webid, and actief:只需为以下列创建单个索引:datum、webid 和 actief:

create index idx_datum on nieuws(datum);
create index idx_webid on nieuws(webid);
create index idx_actief on nieuws(actief);

This should yield in a better performance of this query.这应该会产生更好的查询性能。

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

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