MySql技术之"虚拟表增加索引"
一、虚拟表增加索引
创建虚拟表,并且增加SKU索引:INDEX idx_sku (sku)
CREATE TEMPORARY TABLE t_sku_analy_temp ( sku VARCHAR(225) PRIMARY KEY, sell_price DECIMAL(10, 2), profit DECIMAL(10, 2), sku_cost DECIMAL(10, 2), INDEX idx_sku (sku) ) ENGINE=InnoDB SELECT sku, SUM(daily_sell_price) AS sell_price, SUM(profit) AS profit,sum(sku_cost) as sku_cost, FROM t_sku_analy WHERE stati_time >= '2023-04-01 00:00:00' AND stati_time <= '2023-04-30 00:00:00' GROUP BY sku;
* 博客文章部分截图及内容来自于学习的书本及相应培训课程,仅做学习讨论之用,不做商业用途。
* 如有侵权,马上联系我,我立马删除对应链接。
* 备注:王子威
* 我的网易邮箱:wzw_1314_520@163.com