简体   繁体   English

SQL 查询时间 - 执行时间

[英]SQL Query time - execution time

I am carrying out the below query and it has said "Loading" for ages now.我正在执行以下查询,它已经说“正在加载”很长时间了。 I can look at my other table within the database but when I try to look at the one I was querying it just says "Loading" , would this kind of query take long.我可以查看数据库中的另一个表,但是当我尝试查看我正在查询的表时,它只显示 "Loading" ,这种查询是否需要很长时间。 I have about 59k records in that test_db table and 10k in the other.我在那个 test_db 表中有大约 59k 条记录,在另一个表中有 10k 条记录。 I am using waamp server 3.0.6 on windows 10我在 Windows 10 上使用 waamp 服务器 3.0.6

UPDATE test_db t
JOIN whisky w ON t.name=w.whisky_name
SET t.whisky_id = w.whisky_id;

To speed this query:要加快此查询:

UPDATE test_db t JOIN
       whisky w
       ON t.name = w.whisky_name
    SET t.whisky_id = w.whisky_id;

You want an index.你想要一个索引。 The optimal index is whisky(whisky_name, whisky_id) .最佳索引是whisky(whisky_name, whisky_id) It is very important that whisky_name be the first key in the index.whisky_name作为索引中的第一个键非常重要。

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

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