gpt4 book ai didi

mysql - 优化my.cnf参数以提高mysql查询的执行速度

转载 作者:行者123 更新时间:2023-11-29 22:22:25 24 4
gpt4 key购买 nike

我有一个数据库,其中有1万亿条记录插入到20个Myisam mysql表中,并且我的程序每次将执行800个选择mysql查询,其中包含多个联接和索引,因此我如何优化my.cnf参数以提高mysql查询的执行速度,因为每个mysql查询的数据时间花费很长时间。

mysql查询是
从bh.webdav_formulary_detail wfd INNER JOIN bh.payer_map pm ON wfd.payer_map_id = pm.payer_map_id INNER JOIN bh.ndc_lookup nl ON wfd.product_id = nl.uid WHERE pm中选择nl.ndc,Formulary_status从bh.webdav_formulary_detail wfd。 Formulary_id ='01244'和nl.ndc in('16590061572','35356078830','35356078860','35356078890','49999085690','54868381500','54868381501','54868381503','54868381504','54868381505' ,'59011044010','59011044020','63629377401','63629377402','63629377403');

显示创建表webdav_formulary_detail;

|桌子创建表|
+ ------------------------- + ----------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------- +
| webdav_formulary_detail |创建表webdav_formulary_detail
  product_id mediumint(8)unsigned NOT NULL,
  formulary_status char(2)NOT NULL,
  file_iid smallint(5)unsigned NOT NULL默认值'0',
  payer_map_id smallint(5)unsigned NOT NULL,
  密钥payer_map_idpayer_map_id),
  按键product_idproduct_id
)ENGINE = MyISAM DEFAULT CHARSET = latin1 |

显示创建表ndc_lookup;
+ ------------ + ------------------------------------ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------------------- +
|桌子创建表|
+ ------------ + ------------------------------------ -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------------------- +
| ndc_lookup |创建表ndc_lookup
  uid mediumint(8)unsigned NOT NULL,
  ndc char(11)NOT NULL默认为'0',
  主键(uid),
  密钥uiduid),
  按键ndcndc
)ENGINE = MyISAM DEFAULT CHARSET = latin1 |

显示创建表payer_map;
+ ----------- + ------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------- +
|桌子创建表|
+ ----------- + ------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------- +
| payer_map |创建表payer_map
  payer_map_id smallint(5)unsigned NOT NULL,
  payer_id varchar(80)默认为空,
  formulary_id varchar(50)默认为空,
  alternate_id varchar(50)默认为空,
  主键(payer_map_id),
  密钥payer_map_idpayer_map_id),
  密钥payer_idpayer_id),
  密钥formulary_idformulary_id),
  按键alternate_idalternate_id
)ENGINE = MyISAM DEFAULT CHARSET = latin1 |

最佳答案

我使用this取得了一些成功,它是一个perl脚本,可以分析您的设置并提出一些建议。

关于mysql - 优化my.cnf参数以提高mysql查询的执行速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30589598/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com