Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6f2db629
Commit
6f2db629
authored
Dec 22, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post-review fixes.
parent
65af63b0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
351 additions
and
355 deletions
+351
-355
mysql-test/r/index_intersect.result
mysql-test/r/index_intersect.result
+232
-242
mysql-test/r/index_intersect_innodb.result
mysql-test/r/index_intersect_innodb.result
+69
-79
mysql-test/r/index_merge_myisam.result
mysql-test/r/index_merge_myisam.result
+6
-6
mysql-test/t/index_intersect.test
mysql-test/t/index_intersect.test
+19
-19
sql/mysql_priv.h
sql/mysql_priv.h
+1
-3
sql/mysqld.cc
sql/mysqld.cc
+1
-1
sql/opt_range.cc
sql/opt_range.cc
+22
-3
sql/sql_select.cc
sql/sql_select.cc
+1
-2
No files found.
mysql-test/r/index_intersect.result
View file @
6f2db629
...
...
@@ -83,98 +83,168 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
SELECT * FROM City
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
131 Melbourne AUS 2865329
653 Madrid ESP 2879052
766 Manila PHL 1581082
942 Medan IDN 1843919
1024 Mumbai (Bombay) IND 10500000
131 Melbourne AUS 2865329
1381 Mashhad IRN 1887405
2259 Medellín COL 1861265
3520 Minsk BLR 1674000
3580 Moscow RUS 8389200
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
131 Melbourne AUS 2865329
653 Madrid ESP 2879052
766 Manila PHL 1581082
942 Medan IDN 1843919
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
1024 Mumbai (Bombay) IND 10500000
131 Melbourne AUS 2865329
1381 Mashhad IRN 1887405
2259 Medellín COL 1861265
3520 Minsk BLR 1674000
3580 Moscow RUS 8389200
653 Madrid ESP 2879052
766 Manila PHL 1581082
942 Medan IDN 1843919
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
77 Mar del Plata ARG 512880
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
1024 Mumbai (Bombay) IND 10500000
1042 Madurai IND 977856
1051 Meerut IND 753778
1074 Mysore IND 480692
1081 Moradabad IND 429214
1098 Malegaon IND 342595
131 Melbourne AUS 2865329
1366 Mosul IRQ 879000
1381 Mashhad IRN 1887405
1465 Milano ITA 1300977
1559 Matsuyama JPN 466133
1560 Matsudo JPN 461126
1578 Machida JPN 364197
1595 Miyazaki JPN 303784
1810 Montréal CAN 1016376
1816 Mississauga CAN 608072
1882 Mombasa KEN 461753
1945 Mudanjiang CHN 570000
2005 Ma´anshan CHN 305421
215 Manaus BRA 1255049
223 Maceió BRA 786288
2259 Medellín COL 1861265
2267 Manizales COL 337580
2300 Mbuji-Mayi COD 806475
2348 Masan KOR 441242
2440 Monrovia LBR 850000
2454 Macao MAC 437500
2487 Marrakech MAR 621914
2491 Meknès MAR 460000
250 Mauá BRA 375055
2523 Monterrey MEX 1108499
2526 Mexicali MEX 764902
2530 Mérida MEX 703324
2537 Morelia MEX 619958
2554 Matamoros MEX 416428
2557 Mazatlán MEX 380265
256 Moji das Cruzes BRA 339194
2698 Maputo MOZ 1018938
2699 Matola MOZ 424662
2711 Mandalay MMR 885300
2712 Moulmein (Mawlamyine) MMR 307900
2734 Managua NIC 959000
2756 Mushin NGA 333200
2757 Maiduguri NGA 320000
2826 Multan PAK 1182441
2975 Marseille FRA 798430
3070 Munich [München] DEU 1194560
3086 Mannheim DEU 307730
3175 Mekka SAU 965700
3176 Medina SAU 608300
3214 Mogadishu SOM 997000
3364 Mersin (Içel) TUR 587212
3371 Malatya TUR 330312
3434 Mykolajiv UKR 508000
3435 Mariupol UKR 490000
3438 Makijivka UKR 384000
3492 Montevideo URY 1236000
3520 Minsk BLR 1674000
3522 Mogiljov BLR 356000
3540 Maracaíbo VEN 1304776
3545 Maracay VEN 444443
3547 Maturín VEN 319726
3580 Moscow RUS 8389200
3622 Magnitogorsk RUS 427900
3625 Murmansk RUS 376300
3636 Mahat?kala RUS 332800
3810 Memphis USA 650100
3811 Milwaukee USA 596974
3834 Mesa USA 396375
3837 Minneapolis USA 382618
3839 Miami USA 362470
462 Manchester GBR 430000
653 Madrid ESP 2879052
658 Málaga ESP 530553
661 Murcia ESP 353504
766 Manila PHL 1581082
77 Mar del Plata ARG 512880
778 Makati PHL 444867
781 Marikina PHL 391170
783 Muntinlupa PHL 379310
786 Malabon PHL 338855
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
942 Medan IDN 1843919
947 Malang IDN 716862
962 Manado IDN 332288
963 Mataram IDN 306600
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
1024 Mumbai (Bombay) IND 10500000
1042 Madurai IND 977856
1051 Meerut IND 753778
1074 Mysore IND 480692
1081 Moradabad IND 429214
1098 Malegaon IND 342595
131 Melbourne AUS 2865329
1366 Mosul IRQ 879000
1381 Mashhad IRN 1887405
1465 Milano ITA 1300977
...
...
@@ -187,6 +257,8 @@ ID Name Country Population
1882 Mombasa KEN 461753
1945 Mudanjiang CHN 570000
2005 Ma´anshan CHN 305421
215 Manaus BRA 1255049
223 Maceió BRA 786288
2259 Medellín COL 1861265
2267 Manizales COL 337580
2300 Mbuji-Mayi COD 806475
...
...
@@ -195,12 +267,14 @@ ID Name Country Population
2454 Macao MAC 437500
2487 Marrakech MAR 621914
2491 Meknès MAR 460000
250 Mauá BRA 375055
2523 Monterrey MEX 1108499
2526 Mexicali MEX 764902
2530 Mérida MEX 703324
2537 Morelia MEX 619958
2554 Matamoros MEX 416428
2557 Mazatlán MEX 380265
256 Moji das Cruzes BRA 339194
2698 Maputo MOZ 1018938
2699 Matola MOZ 424662
2711 Mandalay MMR 885300
...
...
@@ -235,97 +309,23 @@ ID Name Country Population
3834 Mesa USA 396375
3837 Minneapolis USA 382618
3839 Miami USA 362470
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
2454 Macao MAC 437500
223 Maceió BRA 786288
1578 Machida JPN 364197
462 Manchester GBR 430000
653 Madrid ESP 2879052
1042 Madurai IND 977856
3622 Magnitogorsk RUS 427900
3636 Mahat?kala RUS 332800
2757 Maiduguri NGA 320000
778 Makati PHL 444867
3438 Makijivka UKR 384000
786 Malabon PHL 338855
658 Málaga ESP 530553
947 Malang IDN 716862
3371 Malatya TUR 330312
1098 Malegaon IND 342595
962 Manado IDN 332288
2734 Managua NIC 959000
215 Manaus BRA 1255049
462 Manchester GBR 430000
2711 Mandalay MMR 885300
661 Murcia ESP 353504
766 Manila PHL 1581082
2267 Manizales COL 337580
3086 Mannheim DEU 307730
2698 Maputo MOZ 1018938
77 Mar del Plata ARG 512880
3540 Maracaíbo VEN 1304776
3545 Maracay VEN 444443
778 Makati PHL 444867
781 Marikina PHL 391170
3435 Mariupol UKR 490000
2487 Marrakech MAR 621914
2975 Marseille FRA 798430
2348 Masan KOR 441242
1381 Mashhad IRN 1887405
2554 Matamoros MEX 416428
963 Mataram IDN 306600
2699 Matola MOZ 424662
1560 Matsudo JPN 461126
1559 Matsuyama JPN 466133
3547 Maturín VEN 319726
250 Mauá BRA 375055
2557 Mazatlán MEX 380265
2005 Ma´anshan CHN 305421
2300 Mbuji-Mayi COD 806475
942 Medan IDN 1843919
2259 Medellín COL 1861265
3176 Medina SAU 608300
1051 Meerut IND 753778
3175 Mekka SAU 965700
2491 Meknès MAR 460000
131 Melbourne AUS 2865329
3810 Memphis USA 650100
2530 Mérida MEX 703324
783 Muntinlupa PHL 379310
786 Malabon PHL 338855
80 Merlo ARG 463846
3364 Mersin (Içel) TUR 587212
3834 Mesa USA 396375
2526 Mexicali MEX 764902
3839 Miami USA 362470
1465 Milano ITA 1300977
3811 Milwaukee USA 596974
3837 Minneapolis USA 382618
3520 Minsk BLR 1674000
1816 Mississauga CAN 608072
1595 Miyazaki JPN 303784
3214 Mogadishu SOM 997000
3522 Mogiljov BLR 356000
256 Moji das Cruzes BRA 339194
1882 Mombasa KEN 461753
2440 Monrovia LBR 850000
2523 Monterrey MEX 1108499
3492 Montevideo URY 1236000
1810 Montréal CAN 1016376
1081 Moradabad IND 429214
2537 Morelia MEX 619958
83 Moreno ARG 356993
87 Morón ARG 349246
3580 Moscow RUS 8389200
1366 Mosul IRQ 879000
2712 Moulmein (Mawlamyine) MMR 307900
1945 Mudanjiang CHN 570000
2826 Multan PAK 1182441
1024 Mumbai (Bombay) IND 10500000
3070 Munich [München] DEU 1194560
783 Muntinlupa PHL 379310
661 Murcia ESP 353504
3625 Murmansk RUS 376300
2756 Mushin NGA 333200
3434 Mykolajiv UKR 508000
1074 Mysore IND 480692
942 Medan IDN 1843919
947 Malang IDN 716862
962 Manado IDN 332288
963 Mataram IDN 306600
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 5000000;
ID Name Country Population
...
...
@@ -486,30 +486,30 @@ SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
126 Yerevan ARM 1248700
130 Sydney AUS 3276207
131 Melbourne AUS 2865329
132 Brisbane AUS 1291117
133 Perth AUS 1096829
144 Baku AZE 1787800
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
126 Yerevan ARM 1248700
130 Sydney AUS 3276207
131 Melbourne AUS 2865329
132 Brisbane AUS 1291117
133 Perth AUS 1096829
144 Baku AZE 1787800
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'L%';
ID Name Country Population
...
...
@@ -650,72 +650,72 @@ SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z' ;
ID Name Country Population
3176 Medina SAU 608300
3363 Konya TUR 628364
3810 Memphis USA 650100
3809 Baltimore USA 651154
3808 Austin USA 656562
3543 Ciudad Guayana VEN 663713
3349 Tunis TUN 690600
3226 Sharq al-Nil SDN 700887
3433 Kryvyi Rig UKR 703000
3807 Columbus USA 711470
3266 Tainan TWN 728060
3806 Jacksonville USA 735167
3048 Stockholm SWE 750348
3805 San Francisco USA 776733
3771 Haiphong VNM 783133
3173 Riyadh SAU 3324000
3174 Jedda SAU 2046300
3175 Mekka SAU 965700
3176 Medina SAU 608300
3197 Pikine SEN 855287
3198 Dakar SEN 785071
3432 Lviv UKR 788000
3362 Gaziantep TUR 789056
3804 Indianapolis USA 791926
3542 Valencia VEN 794246
3431 Zaporizzja UKR 848000
3207 Freetown SLE 850000
3197 Pikine SEN 855287
3541 Barquisimeto VEN 877239
3425 Kampala UGA 890800
3803 San Jose USA 894943
3265 Taichung TWN 940589
3225 Khartum SDN 947483
3802 Detroit USA 951270
3175 Mekka SAU 965700
3208 Singapore SGP 4017733
3214 Mogadishu SOM 997000
3430 Odesa UKR 1011000
3429 Donetsk UKR 1050000
3361 Bursa TUR 1095842
3428 Dnipropetrovsk UKR 1103000
3360 Adana TUR 1131198
3801 San Antonio USA 1144646
3800 Dallas USA 1188580
3799 San Diego USA 1223400
3492 Montevideo URY 1236000
3251 Aleppo SYR 1261983
3224 Omdurman SDN 1271403
3
540 Maracaíbo VEN 1304776
3
798 Phoenix USA 1321045
3
225 Khartum SDN 947483
3
226 Sharq al-Nil SDN 700887
3250 Damascus SYR 1347000
3770 Hanoi VNM 1410000
3251 Aleppo SYR 1261983
3263 Taipei TWN 2641312
3264 Kaohsiung TWN 1475505
3
427 Harkova [Harkiv] UKR 1500000
3
797 Philadelphia USA 151755
0
3
265 Taichung TWN 940589
3
266 Tainan TWN 72806
0
3305 Dar es Salaam TZA 1747000
3
796 Houston USA 1953631
3
539 Caracas VEN 1975294
3
174 Jedda SAU 2046300
3
503 Toskent UZB 2117500
3
320 Bangkok THA 6320174
3
349 Tunis TUN 690600
3
357 Istanbul TUR 8787958
3
358 Ankara TUR 3038159
3359 Izmir TUR 2130359
3360 Adana TUR 1131198
3361 Bursa TUR 1095842
3362 Gaziantep TUR 789056
3363 Konya TUR 628364
3425 Kampala UGA 890800
3426 Kyiv UKR 2624000
3263 Taipei TWN 2641312
3795 Chicago USA 2896016
3358 Ankara TUR 3038159
3173 Riyadh SAU 3324000
3794 Los Angeles USA 3694820
3427 Harkova [Harkiv] UKR 1500000
3428 Dnipropetrovsk UKR 1103000
3429 Donetsk UKR 1050000
3430 Odesa UKR 1011000
3431 Zaporizzja UKR 848000
3432 Lviv UKR 788000
3433 Kryvyi Rig UKR 703000
3492 Montevideo URY 1236000
3503 Toskent UZB 2117500
3539 Caracas VEN 1975294
3540 Maracaíbo VEN 1304776
3541 Barquisimeto VEN 877239
3542 Valencia VEN 794246
3543 Ciudad Guayana VEN 663713
3769 Ho Chi Minh City VNM 3980000
3
208 Singapore SGP 4017733
3
320 Bangkok THA 6320174
3
770 Hanoi VNM 1410000
3
771 Haiphong VNM 783133
3793 New York USA 8008278
3357 Istanbul TUR 8787958
3794 Los Angeles USA 3694820
3795 Chicago USA 2896016
3796 Houston USA 1953631
3797 Philadelphia USA 1517550
3798 Phoenix USA 1321045
3799 San Diego USA 1223400
3800 Dallas USA 1188580
3801 San Antonio USA 1144646
3802 Detroit USA 951270
3803 San Jose USA 894943
3804 Indianapolis USA 791926
3805 San Francisco USA 776733
3806 Jacksonville USA 735167
3807 Columbus USA 711470
3808 Austin USA 656562
3809 Baltimore USA 651154
3810 Memphis USA 650100
SET SESSION sort_buffer_size = 2048;
EXPLAIN
SELECT * FROM City WHERE
...
...
@@ -751,23 +751,23 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City WHERE
Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
...
...
@@ -814,72 +814,72 @@ SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z';
ID Name Country Population
3176 Medina SAU 608300
3363 Konya TUR 628364
3810 Memphis USA 650100
3809 Baltimore USA 651154
3808 Austin USA 656562
3543 Ciudad Guayana VEN 663713
3349 Tunis TUN 690600
3226 Sharq al-Nil SDN 700887
3433 Kryvyi Rig UKR 703000
3807 Columbus USA 711470
3266 Tainan TWN 728060
3806 Jacksonville USA 735167
3048 Stockholm SWE 750348
3805 San Francisco USA 776733
3771 Haiphong VNM 783133
3173 Riyadh SAU 3324000
3174 Jedda SAU 2046300
3175 Mekka SAU 965700
3176 Medina SAU 608300
3197 Pikine SEN 855287
3198 Dakar SEN 785071
3432 Lviv UKR 788000
3362 Gaziantep TUR 789056
3804 Indianapolis USA 791926
3542 Valencia VEN 794246
3431 Zaporizzja UKR 848000
3207 Freetown SLE 850000
3197 Pikine SEN 855287
3541 Barquisimeto VEN 877239
3425 Kampala UGA 890800
3803 San Jose USA 894943
3265 Taichung TWN 940589
3225 Khartum SDN 947483
3802 Detroit USA 951270
3175 Mekka SAU 965700
3208 Singapore SGP 4017733
3214 Mogadishu SOM 997000
3430 Odesa UKR 1011000
3429 Donetsk UKR 1050000
3361 Bursa TUR 1095842
3428 Dnipropetrovsk UKR 1103000
3360 Adana TUR 1131198
3801 San Antonio USA 1144646
3800 Dallas USA 1188580
3799 San Diego USA 1223400
3492 Montevideo URY 1236000
3251 Aleppo SYR 1261983
3224 Omdurman SDN 1271403
3
540 Maracaíbo VEN 1304776
3
798 Phoenix USA 1321045
3
225 Khartum SDN 947483
3
226 Sharq al-Nil SDN 700887
3250 Damascus SYR 1347000
3770 Hanoi VNM 1410000
3251 Aleppo SYR 1261983
3263 Taipei TWN 2641312
3264 Kaohsiung TWN 1475505
3
427 Harkova [Harkiv] UKR 1500000
3
797 Philadelphia USA 151755
0
3
265 Taichung TWN 940589
3
266 Tainan TWN 72806
0
3305 Dar es Salaam TZA 1747000
3
796 Houston USA 1953631
3
539 Caracas VEN 1975294
3
174 Jedda SAU 2046300
3
503 Toskent UZB 2117500
3
320 Bangkok THA 6320174
3
349 Tunis TUN 690600
3
357 Istanbul TUR 8787958
3
358 Ankara TUR 3038159
3359 Izmir TUR 2130359
3360 Adana TUR 1131198
3361 Bursa TUR 1095842
3362 Gaziantep TUR 789056
3363 Konya TUR 628364
3425 Kampala UGA 890800
3426 Kyiv UKR 2624000
3263 Taipei TWN 2641312
3795 Chicago USA 2896016
3358 Ankara TUR 3038159
3173 Riyadh SAU 3324000
3794 Los Angeles USA 3694820
3427 Harkova [Harkiv] UKR 1500000
3428 Dnipropetrovsk UKR 1103000
3429 Donetsk UKR 1050000
3430 Odesa UKR 1011000
3431 Zaporizzja UKR 848000
3432 Lviv UKR 788000
3433 Kryvyi Rig UKR 703000
3492 Montevideo URY 1236000
3503 Toskent UZB 2117500
3539 Caracas VEN 1975294
3540 Maracaíbo VEN 1304776
3541 Barquisimeto VEN 877239
3542 Valencia VEN 794246
3543 Ciudad Guayana VEN 663713
3769 Ho Chi Minh City VNM 3980000
3
208 Singapore SGP 4017733
3
320 Bangkok THA 6320174
3
770 Hanoi VNM 1410000
3
771 Haiphong VNM 783133
3793 New York USA 8008278
3357 Istanbul TUR 8787958
3794 Los Angeles USA 3694820
3795 Chicago USA 2896016
3796 Houston USA 1953631
3797 Philadelphia USA 1517550
3798 Phoenix USA 1321045
3799 San Diego USA 1223400
3800 Dallas USA 1188580
3801 San Antonio USA 1144646
3802 Detroit USA 951270
3803 San Jose USA 894943
3804 Indianapolis USA 791926
3805 San Francisco USA 776733
3806 Jacksonville USA 735167
3807 Columbus USA 711470
3808 Austin USA 656562
3809 Baltimore USA 651154
3810 Memphis USA 650100
SET SESSION sort_buffer_size = default;
DROP INDEX Country ON City;
CREATE INDEX CountryID ON City(Country,ID);
...
...
@@ -917,10 +917,10 @@ ID Name Country Population
2698 Maputo MOZ 1018938
2710 Rangoon (Yangon) MMR 3361700
SELECT * FROM City
WHERE Country LIKE 'M%' AND Population >
7
00000;
WHERE Country LIKE 'M%' AND Population >
10
00000;
ID Name Country Population
2464 Kuala Lumpur MYS 1297526
2485 Casablanca MAR 2940623
2690 Chisinau MDA 719900
2515 Ciudad de México MEX 8591309
2516 Guadalajara MEX 1647720
2517 Ecatepec de Morelos MEX 1620303
...
...
@@ -931,18 +931,8 @@ ID Name Country Population
2522 León MEX 1133576
2523 Monterrey MEX 1108499
2524 Zapopan MEX 1002239
2525 Naucalpan de Juárez MEX 857511
2526 Mexicali MEX 764902
2527 Culiacán MEX 744859
2528 Acapulco de Juárez MEX 721011
2529 Tlalnepantla de Baz MEX 720755
2530 Mérida MEX 703324
2482 Bamako MLI 809552
2710 Rangoon (Yangon) MMR 3361700
2711 Mandalay MMR 885300
2696 Ulan Bator MNG 773700
2698 Maputo MOZ 1018938
2
464 Kuala Lumpur MYS 1297526
2
710 Rangoon (Yangon) MMR 3361700
SELECT * FROM City USE INDEX ()
WHERE Country='CHN' AND Population > 1500000;
ID Name Country Population
...
...
mysql-test/r/index_intersect_innodb.result
View file @
6f2db629
...
...
@@ -84,98 +84,77 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
SELECT * FROM City
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
131 Melbourne AUS 2865329
653 Madrid ESP 2879052
766 Manila PHL 1581082
942 Medan IDN 1843919
1024 Mumbai (Bombay) IND 10500000
131 Melbourne AUS 2865329
1381 Mashhad IRN 1887405
2259 Medellín COL 1861265
3520 Minsk BLR 1674000
3580 Moscow RUS 8389200
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
131 Melbourne AUS 2865329
653 Madrid ESP 2879052
766 Manila PHL 1581082
942 Medan IDN 1843919
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
1024 Mumbai (Bombay) IND 10500000
131 Melbourne AUS 2865329
1381 Mashhad IRN 1887405
2259 Medellín COL 1861265
3520 Minsk BLR 1674000
3580 Moscow RUS 8389200
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
77 Mar del Plata ARG 512880
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
131 Melbourne AUS 2865329
215 Manaus BRA 1255049
223 Maceió BRA 786288
250 Mauá BRA 375055
256 Moji das Cruzes BRA 339194
462 Manchester GBR 430000
653 Madrid ESP 2879052
658 Málaga ESP 530553
661 Murcia ESP 353504
766 Manila PHL 1581082
778 Makati PHL 444867
781 Marikina PHL 391170
783 Muntinlupa PHL 379310
786 Malabon PHL 338855
942 Medan IDN 1843919
947 Malang IDN 716862
962 Manado IDN 332288
963 Mataram IDN 306600
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
1024 Mumbai (Bombay) IND 10500000
1042 Madurai IND 977856
1051 Meerut IND 753778
1074 Mysore IND 480692
1081 Moradabad IND 429214
1098 Malegaon IND 342595
131 Melbourne AUS 2865329
1366 Mosul IRQ 879000
1381 Mashhad IRN 1887405
1465 Milano ITA 1300977
...
...
@@ -188,6 +167,8 @@ ID Name Country Population
1882 Mombasa KEN 461753
1945 Mudanjiang CHN 570000
2005 Ma´anshan CHN 305421
215 Manaus BRA 1255049
223 Maceió BRA 786288
2259 Medellín COL 1861265
2267 Manizales COL 337580
2300 Mbuji-Mayi COD 806475
...
...
@@ -196,12 +177,14 @@ ID Name Country Population
2454 Macao MAC 437500
2487 Marrakech MAR 621914
2491 Meknès MAR 460000
250 Mauá BRA 375055
2523 Monterrey MEX 1108499
2526 Mexicali MEX 764902
2530 Mérida MEX 703324
2537 Morelia MEX 619958
2554 Matamoros MEX 416428
2557 Mazatlán MEX 380265
256 Moji das Cruzes BRA 339194
2698 Maputo MOZ 1018938
2699 Matola MOZ 424662
2711 Mandalay MMR 885300
...
...
@@ -236,37 +219,33 @@ ID Name Country Population
3834 Mesa USA 396375
3837 Minneapolis USA 382618
3839 Miami USA 362470
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
77 Mar del Plata ARG 512880
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
131 Melbourne AUS 2865329
215 Manaus BRA 1255049
223 Maceió BRA 786288
250 Mauá BRA 375055
256 Moji das Cruzes BRA 339194
462 Manchester GBR 430000
653 Madrid ESP 2879052
658 Málaga ESP 530553
661 Murcia ESP 353504
766 Manila PHL 1581082
77 Mar del Plata ARG 512880
778 Makati PHL 444867
781 Marikina PHL 391170
783 Muntinlupa PHL 379310
786 Malabon PHL 338855
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
942 Medan IDN 1843919
947 Malang IDN 716862
962 Manado IDN 332288
963 Mataram IDN 306600
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 300000;
ID Name Country Population
1024 Mumbai (Bombay) IND 10500000
1042 Madurai IND 977856
1051 Meerut IND 753778
1074 Mysore IND 480692
1081 Moradabad IND 429214
1098 Malegaon IND 342595
131 Melbourne AUS 2865329
1366 Mosul IRQ 879000
1381 Mashhad IRN 1887405
1465 Milano ITA 1300977
...
...
@@ -279,6 +258,8 @@ ID Name Country Population
1882 Mombasa KEN 461753
1945 Mudanjiang CHN 570000
2005 Ma´anshan CHN 305421
215 Manaus BRA 1255049
223 Maceió BRA 786288
2259 Medellín COL 1861265
2267 Manizales COL 337580
2300 Mbuji-Mayi COD 806475
...
...
@@ -287,12 +268,14 @@ ID Name Country Population
2454 Macao MAC 437500
2487 Marrakech MAR 621914
2491 Meknès MAR 460000
250 Mauá BRA 375055
2523 Monterrey MEX 1108499
2526 Mexicali MEX 764902
2530 Mérida MEX 703324
2537 Morelia MEX 619958
2554 Matamoros MEX 416428
2557 Mazatlán MEX 380265
256 Moji das Cruzes BRA 339194
2698 Maputo MOZ 1018938
2699 Matola MOZ 424662
2711 Mandalay MMR 885300
...
...
@@ -327,6 +310,23 @@ ID Name Country Population
3834 Mesa USA 396375
3837 Minneapolis USA 382618
3839 Miami USA 362470
462 Manchester GBR 430000
653 Madrid ESP 2879052
658 Málaga ESP 530553
661 Murcia ESP 353504
766 Manila PHL 1581082
77 Mar del Plata ARG 512880
778 Makati PHL 444867
781 Marikina PHL 391170
783 Muntinlupa PHL 379310
786 Malabon PHL 338855
80 Merlo ARG 463846
83 Moreno ARG 356993
87 Morón ARG 349246
942 Medan IDN 1843919
947 Malang IDN 716862
962 Manado IDN 332288
963 Mataram IDN 306600
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'M%' AND Population > 5000000;
ID Name Country Population
...
...
@@ -487,30 +487,30 @@ SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
126 Yerevan ARM 1248700
130 Sydney AUS 3276207
131 Melbourne AUS 2865329
132 Brisbane AUS 1291117
133 Perth AUS 1096829
144 Baku AZE 1787800
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
ID Name Country Population
1 Kabul AFG 1780000
126 Yerevan ARM 1248700
130 Sydney AUS 3276207
131 Melbourne AUS 2865329
132 Brisbane AUS 1291117
133 Perth AUS 1096829
144 Baku AZE 1787800
56 Luanda AGO 2022000
69 Buenos Aires ARG 2982146
70 La Matanza ARG 1266461
71 Córdoba ARG 1157507
SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'L%';
ID Name Country Population
...
...
@@ -752,23 +752,23 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
71 Córdoba ARG 1157507
151 Chittagong BGD 1392860
212 Curitiba BRA 1584232
608 Cairo EGY 6789479
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
1026 Calcutta [Kolkata] IND 4399819
1027 Chennai (Madras) IND 3841396
151 Chittagong BGD 1392860
1892 Chongqing CHN 6351600
1898 Chengdu CHN 3361500
1900 Changchun CHN 2812000
1910 Changsha CHN 1809800
212 Curitiba BRA 1584232
2258 Cali COL 2077386
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
3539 Caracas VEN 1975294
3795 Chicago USA 2896016
608 Cairo EGY 6789479
71 Córdoba ARG 1157507
712 Cape Town ZAF 2352121
926 Conakry GIN 1090610
SELECT * FROM City WHERE
Name LIKE 'M%' AND Population > 1500000;
ID Name Country Population
...
...
@@ -918,10 +918,9 @@ ID Name Country Population
2698 Maputo MOZ 1018938
2710 Rangoon (Yangon) MMR 3361700
SELECT * FROM City
WHERE Country LIKE 'M%' AND Population >
7
00000;
WHERE Country LIKE 'M%' AND Population >
10
00000;
ID Name Country Population
2464 Kuala Lumpur MYS 1297526
2482 Bamako MLI 809552
2485 Casablanca MAR 2940623
2515 Ciudad de México MEX 8591309
2516 Guadalajara MEX 1647720
...
...
@@ -933,17 +932,8 @@ ID Name Country Population
2522 León MEX 1133576
2523 Monterrey MEX 1108499
2524 Zapopan MEX 1002239
2525 Naucalpan de Juárez MEX 857511
2526 Mexicali MEX 764902
2527 Culiacán MEX 744859
2528 Acapulco de Juárez MEX 721011
2529 Tlalnepantla de Baz MEX 720755
2530 Mérida MEX 703324
2690 Chisinau MDA 719900
2696 Ulan Bator MNG 773700
2698 Maputo MOZ 1018938
2710 Rangoon (Yangon) MMR 3361700
2711 Mandalay MMR 885300
SELECT * FROM City USE INDEX ()
WHERE Country='CHN' AND Population > 1500000;
ID Name Country Population
...
...
mysql-test/r/index_merge_myisam.result
View file @
6f2db629
...
...
@@ -1506,7 +1506,7 @@ index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_inter
set optimizer_switch='default,index_merge_sort_union=off';
select @@optimizer_switch;
@@optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=o
n
index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=o
ff
set optimizer_switch=4;
ERROR 42000: Variable 'optimizer_switch' can't be set to the value of '4'
set optimizer_switch=NULL;
...
...
@@ -1533,21 +1533,21 @@ set optimizer_switch=default;
set optimizer_switch='index_merge=off,index_merge_union=off,default';
select @@optimizer_switch;
@@optimizer_switch
index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
n
index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
ff
set optimizer_switch=default;
select @@global.optimizer_switch;
@@global.optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
n
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
ff
set @@global.optimizer_switch=default;
select @@global.optimizer_switch;
@@global.optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
n
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
ff
#
# Check index_merge's @@optimizer_switch flags
#
select @@optimizer_switch;
@@optimizer_switch
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
n
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
ff
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int, c int, filler char(100),
...
...
@@ -1657,6 +1657,6 @@ id select_type table type possible_keys key key_len ref rows Extra
set optimizer_switch=default;
show variables like 'optimizer_switch';
Variable_name Value
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
n
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=o
ff
drop table t0, t1;
set optimizer_switch= @optimizer_switch_save;
mysql-test/t/index_intersect.test
View file @
6f2db629
...
...
@@ -75,24 +75,24 @@ SELECT * FROM City
# the previous 4 plans are valid and return
# the correct results when executed
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE Name LIKE 'C%' AND Population > 1000000
;
--
sorted_result
SELECT
*
FROM
City
WHERE
Name
LIKE
'C%'
AND
Population
>
1000000
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE Name LIKE 'M%' AND Population > 1500000
;
--
sorted_result
SELECT
*
FROM
City
WHERE
Name
LIKE
'M%'
AND
Population
>
1500000
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE Name LIKE 'M%' AND Population > 300000
;
--
sorted_result
SELECT
*
FROM
City
WHERE
Name
LIKE
'M%'
AND
Population
>
300000
;
...
...
@@ -223,10 +223,10 @@ SELECT * FROM City USE INDEX ()
SELECT
*
FROM
City
WHERE
ID
BETWEEN
501
AND
1000
AND
Population
>
700000
AND
Country
LIKE
'C%'
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%'
;
--
sorted_result
SELECT
*
FROM
City
WHERE
ID
BETWEEN
1
AND
500
AND
Population
>
1000000
AND
Country
LIKE
'A%'
;
...
...
@@ -237,20 +237,20 @@ SELECT * FROM City USE INDEX ()
SELECT
*
FROM
City
WHERE
ID
BETWEEN
2001
AND
2500
AND
Population
>
300000
AND
Country
LIKE
'L%'
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE ID BETWEEN 3701 AND 4000 AND Population > 700000
AND Country BETWEEN 'S' AND 'Z'
;
--
sorted_result
SELECT
*
FROM
City
WHERE
ID
BETWEEN
3701
AND
4000
AND
Population
>
700000
AND
Country
BETWEEN
'S'
AND
'Z'
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z'
;
--
sorted_result
SELECT
*
FROM
City
WHERE
ID
BETWEEN
3001
AND
4000
AND
Population
>
600000
AND
Country
BETWEEN
'S'
AND
'Z'
;
...
...
@@ -293,7 +293,7 @@ SELECT * FROM City
#Yet the query themselves return the correct results in this case as well
--
sorted_result
SELECT
*
FROM
City
WHERE
Name
LIKE
'C%'
AND
Population
>
1000000
;
...
...
@@ -310,7 +310,7 @@ SELECT * FROM City
SELECT
*
FROM
City
WHERE
ID
BETWEEN
1
AND
500
AND
Population
>
1000000
AND
Country
LIKE
'A%'
;
--
sorted_result
SELECT
*
FROM
City
WHERE
ID
BETWEEN
3001
AND
4000
AND
Population
>
600000
AND
Country
BETWEEN
'S'
AND
'Z'
;
...
...
@@ -353,17 +353,17 @@ SELECT * FROM City
# Check that the previous 3 plans return the right results when executed
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE Country LIKE 'M%' AND Population > 1000000
;
--
sorted_result
SELECT
*
FROM
City
WHERE
Country
LIKE
'M%'
AND
Population
>
700000
;
WHERE
Country
LIKE
'M%'
AND
Population
>
1000000
;
--
sorted_result
SELECT
*
FROM
City
USE
INDEX
()
WHERE Country='CHN' AND Population > 1500000
;
--
sorted_result
SELECT
*
FROM
City
WHERE
Country
=
'CHN'
AND
Population
>
1500000
;
...
...
sql/mysql_priv.h
View file @
6f2db629
...
...
@@ -559,14 +559,12 @@ class Default_object_creation_ctx : public Object_creation_ctx
# define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \
OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_INTERSECT)
OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT)
#else
# define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \
OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_INTERSECT | \
OPTIMIZER_SWITCH_TABLE_ELIMINATION)
#endif
...
...
sql/mysqld.cc
View file @
6f2db629
...
...
@@ -433,7 +433,7 @@ static const char *sql_mode_str= "OFF";
static
const
char
*
optimizer_switch_str
=
"index_merge=on,index_merge_union=on,"
"index_merge_sort_union=on,"
"index_merge_intersection=on,"
"index_merge_sort_intersection=o
n
"
"index_merge_sort_intersection=o
ff
"
#ifndef DBUG_OFF
",table_elimination=on"
;
#else
...
...
sql/opt_range.cc
View file @
6f2db629
...
...
@@ -4863,6 +4863,17 @@ ha_rows records_in_index_intersect_extension(PARTIAL_INDEX_INTERSECT_INFO *curr,
when searching for the best intersection plan. It also allocates
memory to store the most cheap index intersection.
NOTES
When selecting candidates for index intersection we always take only
one representative out of any set of indexes that share the same range
conditions. These indexes always have the same prefixes and the
components of this prefixes are exactly those used in these range
conditions.
Range conditions over clustered primary key (cpk) is always used only
as the condition that filters out some rowids retrieved by the scans
for secondary indexes. The cpk index will be handled in special way by
the function that search for the best index intersection.
RETURN
FALSE in the case of success
TRUE otherwise
...
...
@@ -4935,7 +4946,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
if
(
*
index_scan
==
cpk_scan
)
continue
;
if
(
cpk_scan
&&
cpk_scan
->
used_key_parts
=
=
used_key_parts
&&
if
(
cpk_scan
&&
cpk_scan
->
used_key_parts
>
=
used_key_parts
&&
same_index_prefix
(
cpk_scan
->
key_info
,
key_info
,
used_key_parts
))
continue
;
...
...
@@ -5012,7 +5023,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
curr
.
intersect_fields
=
&
cpk_scan
->
used_fields
;
curr
.
records
=
cpk_scan
->
records
;
curr
.
length
=
1
;
for
(
scan_ptr
=
selected_index_scans
,
i
=
0
;
*
scan_ptr
;
scan_ptr
++
,
i
++
)
for
(
scan_ptr
=
selected_index_scans
;
*
scan_ptr
;
scan_ptr
++
)
{
ha_rows
scan_records
=
(
*
scan_ptr
)
->
records
;
ha_rows
records
=
records_in_index_intersect_extension
(
&
curr
,
*
scan_ptr
);
...
...
@@ -5022,7 +5033,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
}
else
{
for
(
scan_ptr
=
selected_index_scans
,
i
=
0
;
*
scan_ptr
;
scan_ptr
++
,
i
++
)
for
(
scan_ptr
=
selected_index_scans
;
*
scan_ptr
;
scan_ptr
++
)
(
*
scan_ptr
)
->
filtered_out
=
0
;
}
...
...
@@ -5250,6 +5261,13 @@ ha_rows records_in_index_intersect_extension(PARTIAL_INDEX_INTERSECT_INFO *curr,
}
/*
Estimate the cost a binary search within disjoint cpk range intervals
Number of comparisons to check whether a cpk value satisfies
the cpk range condition = log2(cpk_scan->range_count).
*/
static
inline
double
get_cpk_filter_cost
(
ha_rows
filtered_records
,
INDEX_SCAN_INFO
*
cpk_scan
,
...
...
@@ -5412,6 +5430,7 @@ void find_index_intersect_best_extension(PARTIAL_INDEX_INTERSECT_INFO *curr)
common_info
->
best_length
=
curr
->
length
;
common_info
->
best_records
=
curr
->
records
;
common_info
->
filtered_scans
=
curr
->
filtered_scans
;
/* common_info->best_uses_cpk <=> at least one scan uses a cpk filter */
common_info
->
best_uses_cpk
=
!
curr
->
filtered_scans
.
is_clear_all
();
uint
sz
=
sizeof
(
INDEX_SCAN_INFO
*
)
*
curr
->
length
;
memcpy
(
common_info
->
best_intersect
,
common_info
->
search_scans
,
sz
);
...
...
sql/sql_select.cc
View file @
6f2db629
...
...
@@ -6376,8 +6376,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if
(
tab
->
type
==
JT_REF
&&
tab
->
quick
&&
(((
uint
)
tab
->
ref
.
key
==
tab
->
quick
->
index
&&
tab
->
ref
.
key_length
<
tab
->
quick
->
max_used_key_length
)
||
(
!
tab
->
table
->
intersect_keys
.
is_clear_all
()
&&
tab
->
table
->
intersect_keys
.
is_set
(
tab
->
ref
.
key
))))
tab
->
table
->
intersect_keys
.
is_set
(
tab
->
ref
.
key
)))
{
/* Range uses longer key; Use this instead of ref on key */
tab
->
type
=
JT_ALL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment