dongtuan1980
dongtuan1980
2012-04-04 07:50

防止全表扫描简单查询

已采纳

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). 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. 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.

Here's a screenshot of a query that probably gets run the most:

enter image description here

how would I improve this?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • donglun2024 donglun2024 9年前

    Just create single indices for following columns: datum, webid, and 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.

    点赞 评论 复制链接分享