码迷,mamicode.com
首页 > 数据库 > 详细

mysql select in 怎么优化

时间:2017-07-11 00:56:28      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:优化   生成   code   tween   一点   class   targe   随机数   .net   

2017年7月10日 22:36:54 星期一

原理: 把select where in 变换成 "where = " 或者 "where between and " 这样的子句, 然后用union all 拼接, 一次查询

环境:

php7,

summerPHP框架,

代码部署在杭州(华东)阿里云的机器上,

mysql数据库部署在青岛(华北),

表的记录数量为8200+,

id是主键,hanzi不在索引中

每次id的生成都是随机数, 所以数据比较分散

结果: 

union all 总是慢...... 下边是in的数量为10, 50, 100, 200, 300的计算结果

有此优化想法的同学可以绕道了, 或者我这里有哪里不对的地方也请指出来, 让我哭一会先.....

1. in的数量在10以下的时候, 直接in快一点

2. in的数量是50, union all 总是稍慢

 1 [5] => Array
 2         (
 3             [key] => SELECT id,hanzi FROM pinyin WHERE (id IN ( 417,670,874,969,1106,1130,1151,1223,1253,1351,1376,1384,1996,2435,2535,2547,2626,2695,2820,2883,3157,3576,3617,3780,3809,3814,4262,4413,4722,4888,5003,5041,5449,5715,5893,5929,6005,6029,6081,6126,6321,6477,6902,7035,7079,7143,7303,7417,7736,8073 ))    
 4             [start] => 1499698628.4481
 5             [over] => 1499698628.4756
 6             [cost] => 0.0275
 7         )
 8 
 9     [6] => Array
10         (
11             [key] => (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 417)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 670)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 874)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 969)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1106)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1130)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1151)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1223)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1253)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1351)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1376)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1384)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1996)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2435)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2535)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2547)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2626)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2695)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2820)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2883)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3157)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3576)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3617)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3780)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3809)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3814)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4262)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4413)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4722)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4888)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5003)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5041)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5449)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5715)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5893)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5929)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6005)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6029)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6081)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6126)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6321)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6477)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6902)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7035)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7079)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7143)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7303)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7417)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7736)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8073)    )
12             [start] => 1499698628.4759
13             [over] => 1499698628.5056
14             [cost] => 0.0297
15         )

 

3. in的数量为100时, union all 总是稍慢

 1 [5] => Array
 2         (
 3             [key] => SELECT id,hanzi FROM pinyin WHERE (id IN ( 42,48,117,506,513,618,784,801,820,869,886,888,889,896,942,974,1177,1207,1235,1287,1479,1491,1590,1594,1609,1611,1703,1764,1936,2010,2051,2098,2140,2342,2474,2506,2567,2709,2859,3282,3415,3485,3488,3588,3810,3829,3903,3956,3957,3997,4054,4169,4228,4283,4314,4517,4642,4644,4650,4723,4958,4976,5003,5010,5071,5132,5190,5201,5212,5315,5559,5666,5692,5844,5975,5991,6030,6086,6163,6347,6365,6442,6545,6577,6647,6710,6809,7025,7289,7473,7509,7517,7759,7863,7907,7966,8077,8122,8196 ))    
 4             [start] => 1499698949.2644
 5             [over] => 1499698949.2888
 6             [cost] => 0.0244
 7         )
 8 
 9     [6] => Array
10         (
11             [key] => (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 42)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 48)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 117)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 506)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 513)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 618)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 784)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 801)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 820)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 869)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 886)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 888 AND 889)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 896)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 942)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 974)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1177)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1207)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1235)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1287)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1479)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1491)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1590)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1594)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1609)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1611)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1703)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1764)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1936)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2010)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2051)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2098)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2140)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2342)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2474)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2506)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2567)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2709)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2859)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3282)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3415)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3485)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3488)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3588)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3810)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3829)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3903)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 3956 AND 3957)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3997)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4054)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4169)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4228)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4283)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4314)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4517)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4642)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4644)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4650)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4723)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4958)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4976)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5003)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5010)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5071)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5132)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5190)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5201)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5212)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5315)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5559)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5666)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5692)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5844)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5975)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5991)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6030)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6086)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6163)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6347)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6365)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6442)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6545)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6577)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6647)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6710)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6809)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7025)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7289)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7473)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7509)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7517)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7759)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7863)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7907)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7966)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8077)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8122)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8196)    )
12             [start] => 1499698949.2892
13             [over] => 1499698949.3163
14             [cost] => 0.0271
15         )

 

4. in的数量在200时, union all 总是稍慢

 1 [5] => Array
 2         (
 3             [key] => SELECT id,hanzi FROM pinyin WHERE (id IN ( 31,48,98,102,137,142,163,346,493,501,555,585,725,750,753,784,889,892,959,963,1042,1080,1089,1096,1122,1136,1213,1215,1252,1298,1303,1322,1373,1374,1451,1456,1463,1500,1525,1539,1772,1813,1858,1886,1923,1924,2020,2054,2083,2132,2155,2169,2245,2256,2357,2437,2445,2490,2526,2571,2722,2728,2839,2869,2891,2919,3106,3109,3159,3219,3236,3265,3268,3360,3363,3419,3500,3550,3561,3564,3617,3626,3635,3662,3701,3748,3797,3819,3848,3905,3923,3944,4109,4158,4160,4179,4193,4306,4405,4425,4499,4516,4525,4621,4642,4650,4723,4816,4850,4852,4883,4906,4928,4944,4973,5046,5092,5101,5110,5113,5126,5228,5277,5305,5339,5362,5378,5426,5427,5465,5562,5566,5570,5613,5622,5632,5798,5811,5812,5833,5857,5898,5899,5950,5974,6029,6038,6066,6074,6088,6103,6115,6220,6250,6271,6468,6485,6511,6538,6580,6710,6713,6732,6745,6781,6807,6877,6884,7018,7020,7068,7086,7090,7096,7113,7123,7181,7203,7278,7316,7431,7458,7468,7506,7517,7529,7581,7676,7740,7768,7825,7924,7974,8001,8095,8100 ))    
 4             [start] => 1499698364.2184
 5             [over] => 1499698364.2504
 6             [cost] => 0.0320
 7         )
 8 
 9     [6] => Array
10         (
11             [key] => (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 31)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 48)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 98)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 102)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 137)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 142)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 163)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 346)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 493)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 501)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 555)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 585)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 725)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 750)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 753)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 784)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 889)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 892)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 959)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 963)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1042)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1080)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1089)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1096)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1122)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1136)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1213)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1215)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1252)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1298)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1303)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1322)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 1373 AND 1374)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1451)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1456)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1463)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1500)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1525)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1539)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1772)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1813)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1858)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1886)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 1923 AND 1924)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2020)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2054)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2083)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2132)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2155)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2169)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2245)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2256)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2357)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2437)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2445)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2490)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2526)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2571)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2722)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2728)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2839)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2869)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2891)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2919)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3106)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3109)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3159)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3219)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3236)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3265)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3268)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3360)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3363)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3419)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3500)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3550)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3561)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3564)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3617)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3626)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3635)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3662)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3701)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3748)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3797)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3819)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3848)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3905)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3923)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3944)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4109)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4158)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4160)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4179)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4193)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4306)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4405)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4425)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4499)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4516)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4525)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4621)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4642)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4650)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4723)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4816)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4850)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4852)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4883)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4906)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4928)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4944)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4973)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5046)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5092)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5101)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5110)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5113)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5126)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5228)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5277)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5305)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5339)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5362)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5378)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 5426 AND 5427)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5465)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5562)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5566)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5570)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5613)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5622)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5632)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5798)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 5811 AND 5812)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5833)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5857)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 5898 AND 5899)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5950)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5974)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6029)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6038)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6066)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6074)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6088)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6103)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6115)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6220)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6250)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6271)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6468)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6485)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6511)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6538)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6580)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6710)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6713)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6732)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6745)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6781)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6807)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6877)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6884)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7018)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7020)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7068)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7086)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7090)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7096)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7113)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7123)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7181)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7203)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7278)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7316)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7431)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7458)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7468)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7506)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7517)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7529)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7581)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7676)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7740)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7768)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7825)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7924)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7974)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8001)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8095)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8100)    )
12             [start] => 1499698364.2511
13             [over] => 1499698364.288
14             [cost] => 0.0369
15         )

5. in的数量在300时, union all 总是很慢

 1 [5] => Array
 2         (
 3             [key] => SELECT id,hanzi FROM pinyin WHERE (id IN ( 57,62,67,80,89,99,122,188,258,344,377,389,401,435,497,521,531,578,582,585,613,627,649,697,720,783,785,806,817,822,870,883,905,927,957,966,998,1066,1069,1073,1091,1135,1169,1177,1214,1304,1310,1314,1328,1350,1400,1450,1475,1502,1516,1579,1669,1684,1688,1804,1832,1936,2022,2066,2091,2172,2214,2237,2242,2257,2259,2265,2268,2294,2296,2297,2362,2369,2384,2393,2419,2426,2521,2572,2595,2608,2730,2759,2778,2805,2839,2842,2867,2905,2909,2916,2930,2985,3001,3120,3158,3188,3196,3210,3261,3280,3310,3317,3323,3353,3371,3384,3436,3462,3481,3486,3504,3551,3565,3592,3677,3705,3728,3746,3755,3767,3787,3806,3878,3911,3977,4012,4020,4035,4072,4084,4211,4218,4231,4254,4283,4288,4309,4316,4338,4392,4396,4413,4511,4523,4529,4548,4553,4582,4686,4701,4747,4758,4780,4804,4851,4860,4913,4922,5004,5087,5144,5160,5175,5235,5264,5358,5414,5416,5439,5449,5527,5552,5576,5616,5624,5637,5640,5663,5685,5718,5762,5763,5772,5860,5875,5880,5909,5918,5923,5952,5961,6005,6048,6075,6085,6176,6183,6327,6347,6375,6428,6447,6498,6545,6575,6582,6586,6588,6592,6620,6635,6644,6650,6710,6747,6795,6796,6810,6821,6823,6873,6918,6932,6943,6955,6958,6959,6968,6973,6990,7061,7081,7123,7154,7179,7183,7188,7211,7220,7231,7236,7250,7471,7564,7569,7572,7581,7607,7642,7645,7688,7701,7709,7721,7724,7729,7748,7776,7782,7788,7803,7850,7893,7913,7936,7942,7944,7945,7971,7974,7987,8006,8013,8015,8040,8060,8063,8072,8076,8128,8138,8151,8167,8176,8198 ))    
 4             [start] => 1499698048.6471
 5             [over] => 1499698048.6715
 6             [cost] => 0.0244
 7         )
 8 
 9     [6] => Array
10         (
11             [key] => (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 57)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 62)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 67)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 80)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 89)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 99)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 122)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 188)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 258)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 344)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 377)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 389)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 401)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 435)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 497)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 521)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 531)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 578)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 582)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 585)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 613)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 627)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 649)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 697)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 720)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 783)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 785)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 806)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 817)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 822)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 870)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 883)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 905)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 927)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 957)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 966)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 998)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1066)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1069)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1073)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1091)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1135)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1169)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1177)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1214)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1304)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1310)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1314)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1328)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1350)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1400)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1450)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1475)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1502)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1516)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1579)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1669)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1684)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1688)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1804)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1832)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 1936)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2022)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2066)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2091)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2172)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2214)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2237)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2242)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2257)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2259)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2265)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2268)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2294)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 2296 AND 2297)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2362)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2369)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2384)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2393)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2419)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2426)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2521)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2572)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2595)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2608)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2730)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2759)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2778)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2805)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2839)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2842)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2867)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2905)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2909)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2916)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2930)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 2985)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3001)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3120)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3158)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3188)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3196)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3210)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3261)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3280)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3310)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3317)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3323)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3353)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3371)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3384)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3436)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3462)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3481)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3486)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3504)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3551)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3565)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3592)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3677)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3705)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3728)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3746)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3755)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3767)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3787)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3806)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3878)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3911)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 3977)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4012)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4020)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4035)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4072)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4084)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4211)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4218)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4231)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4254)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4283)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4288)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4309)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4316)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4338)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4392)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4396)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4413)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4511)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4523)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4529)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4548)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4553)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4582)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4686)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4701)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4747)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4758)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4780)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4804)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4851)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4860)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4913)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 4922)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5004)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5087)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5144)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5160)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5175)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5235)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5264)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5358)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5414)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5416)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5439)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5449)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5527)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5552)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5576)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5616)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5624)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5637)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5640)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5663)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5685)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5718)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 5762 AND 5763)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5772)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5860)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5875)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5880)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5909)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5918)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5923)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5952)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 5961)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6005)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6048)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6075)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6085)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6176)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6183)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6327)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6347)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6375)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6428)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6447)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6498)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6545)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6575)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6582)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6586)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6588)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6592)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6620)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6635)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6644)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6650)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6710)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6747)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 6795 AND 6796)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6810)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6821)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6823)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6873)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6918)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6932)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6943)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6955)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 6958 AND 6959)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6968)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6973)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 6990)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7061)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7081)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7123)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7154)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7179)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7183)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7188)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7211)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7220)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7231)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7236)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7250)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7471)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7564)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7569)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7572)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7581)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7607)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7642)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7645)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7688)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7701)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7709)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7721)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7724)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7729)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7748)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7776)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7782)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7788)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7803)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7850)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7893)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7913)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7936)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7942)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id BETWEEN 7944 AND 7945)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7971)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7974)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 7987)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8006)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8013)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8015)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8040)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8060)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8063)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8072)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8076)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8128)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8138)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8151)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8167)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8176)    ) UNION ALL (SELECT id,hanzi FROM pinyin WHERE 1 AND (id = 8198)    )
12             [start] => 1499698048.6727
13             [over] => 1499698048.7311
14             [cost] => 0.0584
15         )

summerPHP

mysql select in 怎么优化

标签:优化   生成   code   tween   一点   class   targe   随机数   .net   

原文地址:http://www.cnblogs.com/iLoveMyD/p/7148175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!