时间:2021-07-01 10:21:17 帮助过:4人阅读
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 =