1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
|
#
# Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS
#
CREATE TABLE t1 (a int)
ENGINE = InnoDB
PARTITION BY HASH (a) PARTITIONS 2;
INSERT INTO t1 VALUES (0), (1), (2), (3);
CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` PARTITION (`p0`) latin1 latin1_swedish_ci
FLUSH STATUS;
SELECT * FROM v1;
a
0
2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_RND_NEXT 3
HANDLER_TMP_WRITE 24
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
SELECT a FROM t1 PARTITION (p0);
a
0
2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_RND_NEXT 3
HANDLER_TMP_WRITE 24
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
INSERT INTO v1 VALUES (10);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_TMP_WRITE 24
# 2 locks (1 table, all partitions pruned)
FLUSH STATUS;
SELECT * FROM v1;
a
0
10
2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_RND_NEXT 4
HANDLER_TMP_WRITE 24
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
SELECT a FROM t1 PARTITION (p0);
a
0
10
2
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_RND_NEXT 4
HANDLER_TMP_WRITE 24
# 4 locks (1 table, 1 partition lock/unlock)
SELECT * FROM t1;
a
0
1
10
2
3
DROP VIEW v1;
CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0) WITH CHECK OPTION;
FLUSH STATUS;
INSERT INTO v1 VALUES (20);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_TMP_WRITE 24
# 2 locks (1 table, all partitions pruned)
SELECT * FROM v1;
a
0
10
2
20
SELECT * FROM t1;
a
0
1
10
2
20
3
DROP VIEW v1;
CREATE VIEW v1 AS
SELECT a FROM t1 PARTITION (p0) WHERE a = 30 WITH CHECK OPTION;
FLUSH STATUS;
INSERT INTO v1 VALUES (30);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# 4 locks (1 table, 1 partition lock/unlock)
FLUSH STATUS;
INSERT INTO v1 VALUES (31);
ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
# 2 locks (1 table, all partitions pruned)
FLUSH STATUS;
INSERT INTO v1 VALUES (32);
ERROR 44000: CHECK OPTION failed `test`.`v1`
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
# 4 locks (1 table, 1 partition lock/unlock)
SELECT * FROM v1;
a
30
SELECT * FROM t1;
a
0
1
10
2
20
3
30
DROP VIEW v1;
DROP TABLE t1;
# Original tests for WL#5217
# Must have InnoDB as engine to get the same statistics results.
# embedded uses MyISAM as default. CREATE SELECT uses the default engine.
SET @old_default_storage_engine = @@default_storage_engine;
SET @@default_storage_engine = 'InnoDB';
# Test to show if I_S affects HANDLER_ counts
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_TMP_WRITE 24
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
# OK, seems to add number of variables processed before HANDLER_WRITE
# and number of variables + 1 evaluated in the previous call in RND_NEXT
CREATE TABLE t1
(a INT NOT NULL,
b varchar (64),
INDEX (b,a),
PRIMARY KEY (a))
ENGINE = InnoDB
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a) SUBPARTITIONS 2
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0,
SUBPARTITION subp1),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2,
SUBPARTITION subp3),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4,
SUBPARTITION subp5),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6,
SUBPARTITION subp7));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(64) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
# First test that the syntax is OK
SHOW CREATE TABLE t1 PARTITION (subp0);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (subp0)' at line 1
# Not a correct partition list
INSERT INTO t1 PARTITION () VALUES (1, "error");
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') VALUES (1, "error")' at line 1
INSERT INTO t1 PARTITION (pNonExisting) VALUES (1, "error");
ERROR HY000: Unknown partition 'pNonExisting' in table 't1'
INSERT INTO t1 PARTITION (pNeg, pNonExisting) VALUES (1, "error");
ERROR HY000: Unknown partition 'pNonExisting' in table 't1'
# Duplicate partitions and overlapping partitions and subpartitios is OK
FLUSH STATUS;
INSERT INTO t1 PARTITION (pNeg, pNeg) VALUES (-1, "pNeg(-subp1)");
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_KEY 6
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# Should be 1 commit
# 4 external locks (due to pruning of locks)
# (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
# and 18 write (1 ha_innobase + 17 internal I_S write)
INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (-3, "pNeg(-subp1)");
INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (-2, "(pNeg-)subp0");
# should be correct
INSERT INTO t1 PARTITION (`p100-99999`) VALUES (100, "`p100-99999`(-subp6)"), (101, "`p100-99999`(-subp7)"), (1000, "`p100-99999`(-subp6)");
INSERT INTO t1 PARTITION(`p10-99`,subp3) VALUES (1, "subp3"), (10, "p10-99");
FLUSH STATUS;
INSERT INTO t1 PARTITION(subp3) VALUES (3, "subp3");
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# Should be 1 commit
# 4 external locks
# (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
# and 18 write (1 ha_innobase + 17 internal I_S write)
FLUSH STATUS;
LOCK TABLE t1 WRITE;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# should be 1 commit
# 9 locks (1 ha_partition + 8 ha_innobase)
# 17 writes (internal I_S)
INSERT INTO t1 PARTITION(`p0-9`) VALUES (5, "p0-9:subp3");
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
HANDLER_WRITE 2
# + 1 commit
# + 19 rnd next (internal I_S)
# + 19 write (18 internal I_S + 1 insert)
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_RND_NEXT 56
HANDLER_TMP_WRITE 78
HANDLER_WRITE 2
# + 9 locks (unlocks)
# + 19 rnd next (internal I_S)
# + 18 write (internal I_S)
# Not matching partitions with inserted value
INSERT INTO t1 PARTITION (pNeg, pNeg) VALUES (1, "error");
ERROR HY000: Found a row not matching the given partition set
INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (1, "error");
ERROR HY000: Found a row not matching the given partition set
INSERT INTO t1 PARTITION (`p100-99999`) VALUES (1, "error"), (10, "error");
ERROR HY000: Found a row not matching the given partition set
INSERT INTO t1 VALUES (1000000, "error"), (9999999, "error");
ERROR HY000: Table has no partition for value 1000000
INSERT INTO t1 PARTITION (`p100-99999`) VALUES (1000000, "error"), (9999999, "error");
ERROR HY000: Table has no partition for value 1000000
INSERT INTO t1 PARTITION (pNeg, subp4) VALUES (-7, "pNeg(-subp1)"), (-10, "pNeg(-subp0)"), (-1, "pNeg(-subp1)"), (-99, "pNeg(-subp1)");
Got one of the listed errors
SELECT * FROM t1 ORDER BY a;
a b
-3 pNeg(-subp1)
-2 (pNeg-)subp0
-1 pNeg(-subp1)
1 subp3
3 subp3
5 p0-9:subp3
10 p10-99
100 `p100-99999`(-subp6)
101 `p100-99999`(-subp7)
1000 `p100-99999`(-subp6)
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
SET @@global.innodb_stats_on_metadata=ON;
SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_SCHEMA = 'test'
AND TABLE_NAME = 't1' ORDER BY SUBPARTITION_NAME;
PARTITION_NAME SUBPARTITION_NAME TABLE_ROWS
pNeg subp0 1
pNeg subp1 2
p0-9 subp2 0
p0-9 subp3 3
p10-99 subp4 1
p10-99 subp5 0
p100-99999 subp6 2
p100-99999 subp7 1
SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata;
FLUSH STATUS;
SELECT * FROM t1 PARTITION (pNonexistent);
ERROR HY000: Unknown partition 'pNonexistent' in table 't1'
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_TMP_WRITE 24
# should have failed before locking (only 17 internal I_S writes)
FLUSH STATUS;
SELECT * FROM t1 PARTITION (subp2);
a b
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 1
HANDLER_READ_KEY 8
HANDLER_TMP_WRITE 24
# Should be 1 commit
# 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
# 1 read first (also calls index_read)
# 2 read key (first from innobase_get_index and second from index first)
# 17 writes (internal I_S)
FLUSH STATUS;
SELECT * FROM t1 PARTITION (subp2,pNeg) AS TableAlias;
a b
-2 (pNeg-)subp0
-3 pNeg(-subp1)
-1 pNeg(-subp1)
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 3
HANDLER_READ_NEXT 3
HANDLER_TMP_WRITE 24
# Should be 1 commit
# 8 locks (1 ha_partition + 2 + 1 ha_innobase) x 2
# 3 read first (one for each partition)
# 6 read key (3 from read first and 3 from innobase_get_index)
# 3 read next (one next call after each read row)
# 17 writes (internal I_S)
FLUSH STATUS;
LOCK TABLE t1 READ, t1 as TableAlias READ;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 1 commit
# 18 locks
# 18 READ KEY from opening a new partition table instance,
# (1 innobase_get_index for each index, per partition, 1 x 2 x 8 = 16
# + info(HA_STATUS_CONST) call on the partition with the most number
# of rows, 2 innobase_get_index for updating both index statistics)
# 17 writes (internal I_S)
SELECT * FROM t1 PARTITION (subp3) AS TableAlias;
a b
5 p0-9:subp3
1 subp3
3 subp3
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_FIRST 1
HANDLER_READ_NEXT 3
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
# + 1 commit
# + 1 read first (read first key from index in one partition)
# + 2 read key (innobase_get_index from index_init + from index_first)
# + 3 read next (one after each row)
# + 19 rnd next (from the last I_S query)
# + 18 write (internal I_S)
SELECT COUNT(*) FROM t1 PARTITION (`p10-99`);
COUNT(*)
1
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_READ_FIRST 3
HANDLER_READ_NEXT 4
HANDLER_READ_RND_NEXT 56
HANDLER_TMP_WRITE 78
# + 1 commit
# + 2 read first (one for each subpart)
# + 4 read key (innobase_get_index from index_init + from index_first)
# + 1 read next (one after each row)
# + 19 rnd next (from the last I_S query)
# + 18 write (internal I_S)
SELECT * FROM t1 WHERE a = 1000000;
a b
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 4
HANDLER_READ_FIRST 3
HANDLER_READ_NEXT 4
HANDLER_READ_RND_NEXT 84
HANDLER_TMP_WRITE 105
# No matching partition, only internal I_S.
SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100;
a b
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 5
HANDLER_READ_FIRST 3
HANDLER_READ_NEXT 4
HANDLER_READ_RND_NEXT 112
HANDLER_TMP_WRITE 132
# + 18 for unlock (same as lock above) (100 is not in pNeg, no match)
# Test that EXPLAIN PARTITION works
EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNonexistent);
ERROR HY000: Unknown partition 'pNonexistent' in table 't1'
EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0-9_subp2 index NULL b 71 NULL 2 Using index
FLUSH STATUS;
EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2,pNeg) AS TableAlias;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE TableAlias pNeg_subp0,pNeg_subp1,p0-9_subp2 index NULL b 71 NULL 4 Using index
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 8 locks (1 ha_partition + 3 ha_innobase) x 2 (lock/unlock)
EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp3) AS TableAlias;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE TableAlias p0-9_subp3 index NULL b 71 NULL 3 Using index
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 PARTITION (`p10-99`);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p10-99_subp4,p10-99_subp5 index NULL PRIMARY 4 NULL 2 Using index
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1000000;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
# Test how it changes the alias/keywords/reserved words
SELECT * FROM t1 PARTITION;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
SELECT * FROM t1 `PARTITION`;
a b
-2 (pNeg-)subp0
5 p0-9:subp3
10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
1 subp3
3 subp3
100 `p100-99999`(-subp6)
1000 `p100-99999`(-subp6)
101 `p100-99999`(-subp7)
SELECT * FROM t1 AS PARTITION;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION' at line 1
SELECT * FROM t1 AS `PARTITION`;
a b
-2 (pNeg-)subp0
5 p0-9:subp3
10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
1 subp3
3 subp3
100 `p100-99999`(-subp6)
1000 `p100-99999`(-subp6)
101 `p100-99999`(-subp7)
#
# Test REPLACE
#
FLUSH STATUS;
REPLACE INTO t1 PARTITION (subp0) VALUES (-21, 'Should fail!');
ERROR HY000: Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 1
# 2 locks (1 ha_partition) x 2 (lock/unlock), Was 4 locks before WL4443
# explicit pruning says part_id 0 and implicit pruning says part_id 1
# so no partition will be locked!
# 0 rollback (since no locked partition)
# 17 writes (I_S internal)
FLUSH STATUS;
REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'Insert by REPLACE');
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 2
# 1 commit
# 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
# 18 writes (17 I_S internal, 1 ha_innobase)
SELECT * FROM t1 PARTITION (pNeg);
a b
-2 (pNeg-)subp0
-21 Insert by REPLACE
-3 pNeg(-subp1)
-1 pNeg(-subp1)
FLUSH STATUS;
REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'REPLACEd by REPLACE');
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_KEY 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 2
HANDLER_WRITE 2
# 1 commit
# 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
# 2 read key (1 innobase_get_index when init the index + 1 index read
# to get the position to update)
# 1 update (updated one row, since there is no delete trigger, update
# is used instead of delete+insert)
# 18 write (17 from I_S, 1 for the failed insert)
SELECT * FROM t1 PARTITION (pNeg);
a b
-2 (pNeg-)subp0
-3 pNeg(-subp1)
-1 pNeg(-subp1)
-21 REPLACEd by REPLACE
FLUSH STATUS;
LOCK TABLE t1 WRITE;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 1 commit
# 9 locks
# 17 write (internal I_S)
DELETE FROM t1 PARTITION(subp1) WHERE b = "REPLACEd by REPLACE";
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_DELETE 2
HANDLER_READ_KEY 1
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
# + 1 commit
# + 1 delete (one row deleted)
# + 3 read key (1 innodb_get_index in records_in_range,
# 1 innodb_get_index in index_init, 1 index_read in index_read_first)
# + 1 read next (search for another row in secondary index)
# + 19 rnd next (internal I_S)
# + 18 write (internal I_S)
REPLACE INTO t1 PARTITION (subp0) VALUES (-21, 'Should fail!');
ERROR HY000: Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_DELETE 2
HANDLER_READ_KEY 1
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 56
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 78
HANDLER_WRITE 1
# Failed before start_stmt/execution.
# + 19 rnd next (internal I_S)
# 0 rollback (No partition had called start_stmt, all parts pruned)
# + 18 write (internal I_S)
REPLACE INTO t1 PARTITION (pNeg) VALUES (-21, 'Insert by REPLACE');
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_DELETE 2
HANDLER_READ_KEY 1
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 84
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 105
HANDLER_WRITE 3
# + 1 commit
# + 19 rnd next (internal I_S)
# + 19 write (18 internal I_S + 1 real write)
REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'REPLACEd by REPLACE');
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 4
HANDLER_DELETE 2
HANDLER_READ_KEY 2
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 112
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 132
HANDLER_UPDATE 2
HANDLER_WRITE 5
# + 1 commit
# + 2 read key (see non locked query)
# + 19 rnd next (internal I_S)
# + 1 update (see non locked query)
# + 19 write (18 internal I_S + 1 failed write)
SELECT * FROM t1 PARTITION (subp1);
a b
-3 pNeg(-subp1)
-1 pNeg(-subp1)
-21 REPLACEd by REPLACE
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 5
HANDLER_DELETE 2
HANDLER_READ_FIRST 1
HANDLER_READ_KEY 2
HANDLER_READ_NEXT 4
HANDLER_READ_RND_NEXT 140
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 159
HANDLER_UPDATE 2
HANDLER_WRITE 5
# + 1 commit
# + 1 read first
# + 2 read key
# + 3 read next
# + 19 rnd next (internal I_S)
# + 18 write (internal I_S)
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 5
HANDLER_DELETE 2
HANDLER_READ_FIRST 1
HANDLER_READ_KEY 2
HANDLER_READ_NEXT 4
HANDLER_READ_RND_NEXT 168
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 186
HANDLER_UPDATE 2
HANDLER_WRITE 5
# + 9 locks
# + 19 rnd next (internal I_S)
# + 18 write (internal I_S)
#
# Test LOAD
#
SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
a b
-2 (pNeg-)subp0
10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
-21 REPLACEd by REPLACE
FLUSH STATUS;
SELECT * FROM t1 PARTITION (pNeg, `p10-99`) INTO OUTFILE 'loadtest.txt';
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 4
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
# 1 commit
# 10 locks (1 ha_partition + 4 ha_innobase) x 2 (lock/unlock)
# 4 read first (for reading the first row in 4 partitions)
# 8 read key (4 from read first + 4 for index init)
# 5 read next (one after each row)
# 17 write (internal I_S)
FLUSH STATUS;
ALTER TABLE t1 TRUNCATE PARTITION pNeg, `p10-99`;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 10 locks (table + 4 partition) x (lock + unlock)
SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
a b
FLUSH STATUS;
LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg);
ERROR HY000: Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 3
# 6 locks (1 ha_partition + 2 ha_innobase) x 2 (lock+unlock)
# 1 rollback
SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
a b
FLUSH STATUS;
LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg, subp4, subp5);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 10
# 10 lock (1 ha_partition + 4 ha_innobase) x 2 (lock + unlock)
ALTER TABLE t1 TRUNCATE PARTITION pNeg, `p10-99`;
FLUSH STATUS;
LOCK TABLE t1 WRITE;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 9 locks
# 18 read key (ALTER forces table to be closed, see above for open)
LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg, `p10-99`);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
HANDLER_WRITE 10
# + 23 write (18 internal I_S + 5 rows)
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_RND_NEXT 56
HANDLER_TMP_WRITE 78
HANDLER_WRITE 10
# + 9 locks
#
# Test UPDATE
#
FLUSH STATUS;
UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated');
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_KEY 8
HANDLER_READ_RND_NEXT 2
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 2
# 1 commit
# 4 lock (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
# 1 read first (read first row, called from first rnd_next)
# 2 read key (innobase_get_index from rnd_init +
# read next row from second rnd_next)
# 1 update (update the row)
SELECT * FROM t1 PARTITION (subp0) ORDER BY a;
a b
-2 (pNeg-)subp0, Updated
FLUSH STATUS;
UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = -2;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_KEY 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 2
# 1 commit
# 4 lock
# 1 read key
# 1 update
FLUSH STATUS;
UPDATE t1 PARTITION(subp0) SET a = -4, b = concat(b, ', Updated from a = -2')
WHERE a = -2;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_KEY 1
HANDLER_READ_RND 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 2
# 1 commit
# 4 lock
# 2 read key - (2 index read)
# 1 read rnd - rnd_pos
# 1 update
FLUSH STATUS;
UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = 100;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# Nothing, since impossible PARTITION+WHERE clause.
FLUSH STATUS;
UPDATE t1 PARTITION(subp0) SET a = -2, b = concat(b, ', Updated from a = 100')
WHERE a = 100;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# Nothing, since impossible PARTITION+WHERE clause.
FLUSH STATUS;
UPDATE t1 PARTITION(`p100-99999`) SET a = -2, b = concat(b, ', Updated from a = 100')
WHERE a = 100;
ERROR HY000: Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_READ_KEY 1
HANDLER_READ_RND 1
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 1
# 6 lock
# 4 read key (1 index init + 1 index read + 1 rnd init + 1 rnd pos)
# 1 read rnd (rnd pos)
# 1 rollback
FLUSH STATUS;
UPDATE t1 PARTITION(`p100-99999`, pNeg) SET a = -4, b = concat(b, ', Updated from a = 100')
WHERE a = 100;
Got one of the listed errors
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_READ_KEY 1
HANDLER_READ_RND 1
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 1
HANDLER_WRITE 1
# 10 locks
# 4 read key
# 1 read rnd
# 1 rollback
# 18 write (17 internal I_S + 1 failed insert)
FLUSH STATUS;
UPDATE t1 PARTITION(`p100-99999`, pNeg) SET a = -222, b = concat(b, ', Updated from a = 100')
WHERE a = 100;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_DELETE 1
HANDLER_READ_KEY 1
HANDLER_READ_RND 1
HANDLER_TMP_WRITE 24
HANDLER_UPDATE 1
HANDLER_WRITE 1
# 1 commit
# 1 delete
# 4 read key
# 1 read rnd
# 18 write (17 internal I_S + 1 insert)
SELECT * FROM t1 ORDER BY a;
a b
-222 `p100-99999`(-subp6), Updated from a = 100
-21 REPLACEd by REPLACE
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
-3 pNeg(-subp1)
-1 pNeg(-subp1)
1 subp3
3 subp3
5 p0-9:subp3
10 p10-99
101 `p100-99999`(-subp7)
1000 `p100-99999`(-subp6)
# Test of non matching partition (i.e ER_NO_PARTITION_FOUND)
FLUSH STATUS;
UPDATE t1 SET b = concat(b, ', Updated2') WHERE a = 1000000;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# Nothing (no matching partition found)
FLUSH STATUS;
UPDATE t1 PARTITION (pNeg) SET b = concat(b, ', Updated2') WHERE a = 1000000;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# Nothing (no matching partition found)
FLUSH STATUS;
LOCK TABLE t1 WRITE;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 9 locks
UPDATE t1 PARTITION (subp7) SET b = concat(b, ', Updated to 103'), a = 103 WHERE a = 101;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_KEY 1
HANDLER_READ_RND 1
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
HANDLER_UPDATE 2
# + 4 read key
# + 1 read rnd
# + 1 update
UPDATE t1 PARTITION (`p100-99999`) SET b = concat(b, ', Updated to 110'), a = 110 WHERE a = 103;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_DELETE 1
HANDLER_READ_KEY 2
HANDLER_READ_RND 2
HANDLER_READ_RND_NEXT 56
HANDLER_TMP_WRITE 78
HANDLER_UPDATE 3
HANDLER_WRITE 1
# + 1 delete
# + 4 read key
# + 1 read rnd
# + 19 write (18 internal I_S + 1 insert)
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_DELETE 1
HANDLER_READ_KEY 2
HANDLER_READ_RND 2
HANDLER_READ_RND_NEXT 84
HANDLER_TMP_WRITE 105
HANDLER_UPDATE 3
HANDLER_WRITE 1
+ 9 locks
#
# Test DELETE
#
SELECT * FROM t1 ORDER BY b, a;
a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
5 p0-9:subp3
10 p10-99
-3 pNeg(-subp1)
-1 pNeg(-subp1)
-21 REPLACEd by REPLACE
1 subp3
3 subp3
1000 `p100-99999`(-subp6)
-222 `p100-99999`(-subp6), Updated from a = 100
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
FLUSH STATUS;
DELETE FROM t1 PARTITION (pNeg) WHERE a = -1;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_DELETE 2
HANDLER_READ_KEY 1
HANDLER_TMP_WRITE 24
# 1 delete
# 4 locks (pruning works!).
# 1 read key (index read)
FLUSH STATUS;
DELETE FROM t1 PARTITION (subp1) WHERE b like '%subp1%';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_DELETE 2
HANDLER_READ_RND_NEXT 3
HANDLER_TMP_WRITE 24
# 1 delete
# 4 locks
# 1 read first
# 2 read key
# 3 read rnd
FLUSH STATUS;
LOCK TABLE t1 WRITE;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 9 locks
DELETE FROM t1 PARTITION (subp1) WHERE b = 'p0-9:subp3';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 2
HANDLER_READ_KEY 1
HANDLER_READ_RND_NEXT 28
HANDLER_TMP_WRITE 51
# + 3 read key (1 innodb_get_index in records_in_range
# + 1 innobase_get_index in index_init + 1 index read)
DELETE FROM t1 PARTITION (`p0-9`) WHERE b = 'p0-9:subp3';
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_DELETE 2
HANDLER_READ_KEY 3
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 56
HANDLER_TMP_WRITE 78
# + 1 delete
# + 6 read key (same as above, but for two subpartitions)
# + 1 read next (read next after found row)
UNLOCK TABLES;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 3
HANDLER_DELETE 2
HANDLER_READ_KEY 3
HANDLER_READ_NEXT 1
HANDLER_READ_RND_NEXT 84
HANDLER_TMP_WRITE 105
# + 9 locks
# Test multi-table DELETE
# Can be expressed in two different ways.
CREATE TABLE t2 LIKE t1;
FLUSH STATUS;
INSERT INTO t2 PARTITION (`p10-99`, subp3, `p100-99999`) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
HANDLER_READ_KEY 6
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
HANDLER_WRITE 10
# 24 locks (2 table, 5 + 5 subpartitions lock/unlock)
FLUSH STATUS;
ALTER TABLE t2 TRUNCATE PARTITION `p10-99`, `p0-9`, `p100-99999`;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 14 locks (1 table, 6 subpartitions lock/unlock)
FLUSH STATUS;
INSERT INTO t2 PARTITION (subp3) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
ERROR HY000: Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_READ_FIRST 5
HANDLER_READ_KEY 6
HANDLER_ROLLBACK 1
HANDLER_TMP_WRITE 24
HANDLER_WRITE 1
# 16 locks (2 tables, 1 + 5 subpartitions lock/unlock)
FLUSH STATUS;
INSERT IGNORE INTO t2 PARTITION (subp3) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
Warnings:
Warning 1748 Found a row not matching the given partition set
Warning 1748 Found a row not matching the given partition set
Warning 1748 Found a row not matching the given partition set
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
HANDLER_WRITE 7
# 16 locks (2 tables, 1 + 5 subpartitions lock/unlock)
TRUNCATE TABLE t2;
FLUSH STATUS;
INSERT INTO t2 SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
HANDLER_READ_KEY 6
HANDLER_READ_NEXT 5
HANDLER_TMP_WRITE 24
HANDLER_WRITE 10
# 30 locks (2 table, 8 + 5 subpartitions lock/unlock)
FLUSH STATUS;
CREATE TABLE t3 SELECT * FROM t1 PARTITION (pNeg,subp3,`p100-99999`);
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_FIRST 5
HANDLER_READ_NEXT 7
HANDLER_TMP_WRITE 24
HANDLER_WRITE 7
# 14 locks (2 table, 5 subpartitions lock/unlock)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(64) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t1;
a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
10 p10-99
-21 REPLACEd by REPLACE
1 subp3
3 subp3
1000 `p100-99999`(-subp6)
-222 `p100-99999`(-subp6), Updated from a = 100
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
`b` varchar(64) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t2;
a b
10 p10-99
1 subp3
3 subp3
1000 `p100-99999`(-subp6)
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL,
`b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT * FROM t3;
a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
-21 REPLACEd by REPLACE
1 subp3
3 subp3
1000 `p100-99999`(-subp6)
-222 `p100-99999`(-subp6), Updated from a = 100
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
FLUSH STATUS;
DELETE t1 PARTITION (pNeg), t3 FROM t1, t3
WHERE t1.a = t3.a AND t3.b = 'subp3';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (pNeg), t3 FROM t1, t3
WHERE t1.a = t3.a AND t3.b = 'subp3'' at line 1
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_TMP_WRITE 24
# Multi table delete without any matching rows
FLUSH STATUS;
DELETE t1, t2 FROM t1 PARTITION (pNeg), t3, t2 PARTITION (subp3)
WHERE t1.a = t3.a AND t3.b = 'subp3' AND t3.a = t2.a;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_READ_RND_NEXT 3
HANDLER_TMP_WRITE 24
# 12 locks (3 in t1, 1 in t3, 2 in t2) x 2 (lock + unlock)
# 1 read first (first rnd_next in t2)
# 4 read key (1 innodb_get_index in rnd_init in t2 + index read in t2
# + 2 innodb_get_index in index_init in t1)
# 3 read rnd next (3 rnd next in t2, 2 rows + 1 empty)
# Multi table delete matching all rows in subp3 (2 rows in per table)
FLUSH STATUS;
DELETE FROM t2, t3 USING t2 PARTITION (`p0-9`), t3, t1 PARTITION (subp3)
WHERE t1.a = t3.a AND t3.b = 'subp3' AND t2.a = t1.a;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_DELETE 6
HANDLER_READ_FIRST 1
HANDLER_READ_KEY 2
HANDLER_READ_NEXT 2
HANDLER_READ_RND 4
HANDLER_READ_RND_NEXT 16
HANDLER_TMP_WRITE 24
# 4 delete (2 in t2 + 2 in t3)
# 12 locks (3 in t2, 1 in t3, 2 in t1) x 2 (lock + unlock)
# 3 read first (1 in t1 + 1 in t3 + 1 in t3, for second row in t1)
# 17 read key (1 index_init in t1 + 1 read first in t1 +
# 2 index_init in t2 + 1 index read in t2 +
# 1 index_init in t3 + 1 index read in t3 +
# 1 index read in t2 +
# 1 index_init in t3 + 1 index read in t3 +
# 2 index_init in t2 + 2 index read in t2 (from rnd_pos)
# 1 index_init in t3 + 2 index read in t3 (from rnd_pos))
# 2 read next (1 in t1 + 1 in t1, second row)
# 4 read rnd (position on 4 found rows to delete)
# 16 rnd next (8 in t3 + 8 in t3, for second row)
SELECT * FROM t1 ORDER BY a;
a b
-222 `p100-99999`(-subp6), Updated from a = 100
-21 REPLACEd by REPLACE
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
1 subp3
3 subp3
10 p10-99
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
1000 `p100-99999`(-subp6)
SELECT * FROM t2 ORDER BY a;
a b
10 p10-99
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
1000 `p100-99999`(-subp6)
SELECT * FROM t3 ORDER BY a;
a b
-222 `p100-99999`(-subp6), Updated from a = 100
-21 REPLACEd by REPLACE
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
110 `p100-99999`(-subp7), Updated to 103, Updated to 110
1000 `p100-99999`(-subp6)
# Test TRUNCATE TABLE (should fail, since one should use
# ALTER TABLE ... TRUNCATE PARTITION instead)
TRUNCATE TABLE t1 PARTITION(`p10-99`);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION(`p10-99`)' at line 1
# Test of locking in TRUNCATE PARTITION
# Note that it does not support truncating subpartitions
FLUSH STATUS;
ALTER TABLE t1 TRUNCATE PARTITION pNeg;
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
VARIABLE_NAME VARIABLE_VALUE
HANDLER_COMMIT 1
HANDLER_TMP_WRITE 24
# 6 locks (lock/unlock two subpartitions + table)
# Test on non partitioned table
SELECT * FROM t3 PARTITION (pNeg);
ERROR HY000: PARTITION () clause on non partitioned table
DROP TABLE t1, t2, t3;
# Test from superseeded WL# 2682
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (6) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (11) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (16) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (21) ENGINE = MyISAM);
INSERT INTO `t1` VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),
(11), (12), (13), (14), (15), (16), (17), (18), (19), (20);
SELECT * FROM t1;
id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SELECT * FROM t1 PARTITION (p0);
id
1
2
3
4
5
SELECT * FROM t1 PARTITION (p1);
id
6
7
8
9
10
SELECT * FROM t1 PARTITION (p2);
id
11
12
13
14
15
SELECT * FROM t1 PARTITION (p3);
id
16
17
18
19
20
SELECT * FROM t1 PARTITION (p3) WHERE id = 2;
id
SELECT * FROM t1 PARTITION (foo);
ERROR HY000: Unknown partition 'foo' in table 't1'
CREATE TABLE `t2` (
`id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (id) (
PARTITION p0 VALUES LESS THAN (6) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (11) ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (16) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (21) ENGINE = MyISAM);
INSERT INTO `t2` VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),
(11), (12), (13), (14), (15), (16), (17), (18), (19), (20);
SELECT * FROM t2;
id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SELECT * FROM t2 PARTITION (p0);
id
1
2
3
4
5
SELECT * FROM t2 PARTITION (p1);
id
6
7
8
9
10
SELECT * FROM t2 PARTITION (p2);
id
11
12
13
14
15
SELECT * FROM t2 PARTITION (p3);
id
16
17
18
19
20
SELECT * FROM t2 PARTITION (p3) ORDER BY id;
id
16
17
18
19
20
SELECT * FROM t2 PARTITION (p3) WHERE id = 2;
id
SELECT * FROM t2 PARTITION (foo);
ERROR HY000: Unknown partition 'foo' in table 't2'
CREATE TABLE `t3` (
`id` int(32) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (id) (
PARTITION p0 VALUES IN (1,3,5,7),
PARTITION p1 VALUES IN (0,2,4,6,8),
PARTITION p2 VALUES IN (9,10,11,12,13)
);
INSERT INTO `t3` VALUES (1,'first'), (3,'third'),(5,'fifth'),(7,'seventh'),(0,'zilch'),(2,'second'),(4,'fourth'),(6,'sixth'),(8,'eighth'),(9,'ninth'),(10,'tenth'),(11,'eleventh'),(12,'twelfth'),(13,'thirteenth');
SELECT * FROM `t3`;
id name
1 first
3 third
5 fifth
7 seventh
0 zilch
2 second
4 fourth
6 sixth
8 eighth
9 ninth
10 tenth
11 eleventh
12 twelfth
13 thirteenth
SELECT * FROM `t3` PARTITION (p0);
id name
1 first
3 third
5 fifth
7 seventh
SELECT * FROM `t3` PARTITION (p1);
id name
0 zilch
2 second
4 fourth
6 sixth
8 eighth
SELECT * FROM `t3` PARTITION (p2);
id name
9 ninth
10 tenth
11 eleventh
12 twelfth
13 thirteenth
SELECT * FROM `t3` PARTITION (p2) ORDER BY id;
id name
9 ninth
10 tenth
11 eleventh
12 twelfth
13 thirteenth
DROP TABLE IF EXISTS `t4`;
Warnings:
Note 1051 Unknown table 'test.t4'
CREATE TABLE `t4` (
`id` int(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
INSERT INTO `t4` SELECT * FROM `t2`;
INSERT INTO `t4` SELECT * FROM `t2` ORDER BY id;
CREATE TABLE `t5` (
id int(32),
name varchar(64),
purchased date)
PARTITION BY RANGE( YEAR(purchased) )
SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0,
SUBPARTITION s1
),
PARTITION p1 VALUES LESS THAN (2000) (
SUBPARTITION s2,
SUBPARTITION s3
),
PARTITION p2 VALUES LESS THAN MAXVALUE (
SUBPARTITION s4,
SUBPARTITION s5
)
);
INSERT INTO `t5` VALUES (1, 'aaaaaaa', '2006-01-05 00:00:00');
INSERT INTO `t5` VALUES (2, 'bbbbbbb', '2005-08-05 00:00:00');
INSERT INTO `t5` VALUES (3, 'ccccccc', '1985-08-07 00:00:00');
INSERT INTO `t5` VALUES (4, 'ddddddd', '2000-01-01 00:00:00');
INSERT INTO `t5` VALUES (5, 'eeeeeee', '1999-12-01 00:00:00');
INSERT INTO `t5` VALUES (6, 'fffffff', '2003-11-12 00:00:00');
INSERT INTO `t5` VALUES (7, 'ggggggg', '1990-01-05 00:00:00');
INSERT INTO `t5` VALUES (8, 'hhhhhhh', '1978-01-05 00:00:00');
INSERT INTO `t5` VALUES (9, 'iiiiiii', '1979-01-05 00:00:00');
INSERT INTO `t5` VALUES (10, 'jjjjjjj', '1992-01-05 00:00:00');
INSERT INTO `t5` VALUES (11, 'kkkkkkk', '1993-01-05 00:00:00');
INSERT INTO `t5` VALUES (12, 'mmmmmmm', '1994-01-05 00:00:00');
INSERT INTO `t5` VALUES (13, 'nnnnnnn', '1989-01-05 00:00:00');
INSERT INTO `t5` VALUES (14, 'ooooooo', '1983-12-05 00:00:00');
INSERT INTO `t5` VALUES (15, 'ppppppp', '1986-06-05 00:00:00');
INSERT INTO `t5` VALUES (16, 'qqqqqqq', '1974-04-11 00:00:00');
INSERT INTO `t5` VALUES (17, 'qqqqqqq', '1960-03-15 00:00:00');
INSERT INTO `t5` VALUES (18, 'sssssss', '1950-09-23 00:00:00');
INSERT INTO `t5` VALUES (19, 'ttttttt', '1999-08-02 00:00:00');
INSERT INTO `t5` VALUES (20, 'uuuuuuu', '1994-05-28 00:00:00');
SELECT * FROM `t5`;
id name purchased
8 hhhhhhh 1978-01-05
13 nnnnnnn 1989-01-05
14 ooooooo 1983-12-05
18 sssssss 1950-09-23
3 ccccccc 1985-08-07
9 iiiiiii 1979-01-05
15 ppppppp 1986-06-05
16 qqqqqqq 1974-04-11
17 qqqqqqq 1960-03-15
5 eeeeeee 1999-12-01
12 mmmmmmm 1994-01-05
7 ggggggg 1990-01-05
10 jjjjjjj 1992-01-05
11 kkkkkkk 1993-01-05
19 ttttttt 1999-08-02
20 uuuuuuu 1994-05-28
2 bbbbbbb 2005-08-05
6 fffffff 2003-11-12
1 aaaaaaa 2006-01-05
4 ddddddd 2000-01-01
SELECT * FROM `t5` PARTITION(p0) ORDER BY id;
id name purchased
3 ccccccc 1985-08-07
8 hhhhhhh 1978-01-05
9 iiiiiii 1979-01-05
13 nnnnnnn 1989-01-05
14 ooooooo 1983-12-05
15 ppppppp 1986-06-05
16 qqqqqqq 1974-04-11
17 qqqqqqq 1960-03-15
18 sssssss 1950-09-23
SELECT * FROM `t5` PARTITION(s0) ORDER BY id;
id name purchased
8 hhhhhhh 1978-01-05
13 nnnnnnn 1989-01-05
14 ooooooo 1983-12-05
18 sssssss 1950-09-23
SELECT * FROM `t5` PARTITION(s1) ORDER BY id;
id name purchased
3 ccccccc 1985-08-07
9 iiiiiii 1979-01-05
15 ppppppp 1986-06-05
16 qqqqqqq 1974-04-11
17 qqqqqqq 1960-03-15
SELECT * FROM `t5` PARTITION(p1) ORDER BY id;
id name purchased
5 eeeeeee 1999-12-01
7 ggggggg 1990-01-05
10 jjjjjjj 1992-01-05
11 kkkkkkk 1993-01-05
12 mmmmmmm 1994-01-05
19 ttttttt 1999-08-02
20 uuuuuuu 1994-05-28
SELECT * FROM `t5` PARTITION(s2) ORDER BY id;
id name purchased
5 eeeeeee 1999-12-01
12 mmmmmmm 1994-01-05
SELECT * FROM `t5` PARTITION(s3) ORDER BY id;
id name purchased
7 ggggggg 1990-01-05
10 jjjjjjj 1992-01-05
11 kkkkkkk 1993-01-05
19 ttttttt 1999-08-02
20 uuuuuuu 1994-05-28
SELECT * FROM `t5` PARTITION(p2) ORDER BY id;
id name purchased
1 aaaaaaa 2006-01-05
2 bbbbbbb 2005-08-05
4 ddddddd 2000-01-01
6 fffffff 2003-11-12
SELECT * FROM `t5` PARTITION(s4) ORDER BY id;
id name purchased
2 bbbbbbb 2005-08-05
6 fffffff 2003-11-12
SELECT * FROM `t5` PARTITION(s5) ORDER BY id;
id name purchased
1 aaaaaaa 2006-01-05
4 ddddddd 2000-01-01
drop table t1,t2,t3,t4,t5;
create table t1 (a int) partition by hash(a) partitions 3;
insert into t1 values(1),(2),(3);
explain partitions select * from t1 where a=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 partition (p1) where a=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 partition (p1) where a=1 or a=2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 partition (p2) where a=1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t1;
#
# Bug#59864: Crash if table empty: DELETE FROM t2 PARTITION (subp3).
#
CREATE TABLE t1
(a INT NOT NULL,
b varchar (64),
INDEX (b,a),
PRIMARY KEY (a))
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a) SUBPARTITIONS 3
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0,
SUBPARTITION subp1,
SUBPARTITION subp2),
PARTITION `p0-29` VALUES LESS THAN (30)
(SUBPARTITION subp3,
SUBPARTITION subp4,
SUBPARTITION subp5),
PARTITION `p30-299` VALUES LESS THAN (300)
(SUBPARTITION subp6,
SUBPARTITION subp7,
SUBPARTITION subp8),
PARTITION `p300-2999` VALUES LESS THAN (3000)
(SUBPARTITION subp9,
SUBPARTITION subp10,
SUBPARTITION subp11),
PARTITION `p3000-299999` VALUES LESS THAN (300000)
(SUBPARTITION subp12,
SUBPARTITION subp13,
SUBPARTITION subp14));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` varchar(64) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB,
SUBPARTITION `subp2` ENGINE = InnoDB),
PARTITION `p0-29` VALUES LESS THAN (30)
(SUBPARTITION `subp3` ENGINE = InnoDB,
SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p30-299` VALUES LESS THAN (300)
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB,
SUBPARTITION `subp8` ENGINE = InnoDB),
PARTITION `p300-2999` VALUES LESS THAN (3000)
(SUBPARTITION `subp9` ENGINE = InnoDB,
SUBPARTITION `subp10` ENGINE = InnoDB,
SUBPARTITION `subp11` ENGINE = InnoDB),
PARTITION `p3000-299999` VALUES LESS THAN (300000)
(SUBPARTITION `subp12` ENGINE = InnoDB,
SUBPARTITION `subp13` ENGINE = InnoDB,
SUBPARTITION `subp14` ENGINE = InnoDB))
INSERT INTO t1 VALUES (-9, "negative nine"), (-8, "-8"), (-7, "-7"), (-6, "-6"), (-5, "-5"), (-4, "-4"), (-3, "-3"), (-2, "-2"), (-1, "-1");
INSERT INTO t1 VALUES (9, "nine"), (8, "8"), (7, "7"), (6, "6"), (5, "5"), (4, "4"), (3, "3"), (2, "2"), (1, "1");
INSERT INTO t1 VALUES (39, "Thirty nine"), (38, "38"), (37, "37"), (36, "36"), (35, "35"), (34, "34"), (33, "33"), (32, "32"), (31, "31");
INSERT INTO t1 VALUES (339, "Three hundred thirty nine"), (338, "338"), (337, "337"), (336, "336"), (335, "335"), (334, "334"), (333, "333"), (332, "332"), (331, "331");
INSERT INTO t1 VALUES (3339, "Three thousand three hundred thirty nine"), (3338, "3338"), (3337, "3337"), (3336, "3336"), (3335, "3335"), (3334, "3334"), (3333, "3333"), (3332, "3332"), (3331, "3331");
SELECT * FROM t1;
a b
-1 -1
-2 -2
-3 -3
-4 -4
-5 -5
-6 -6
-7 -7
-8 -8
-9 negative nine
1 1
2 2
3 3
31 31
32 32
33 33
331 331
332 332
333 333
3331 3331
3332 3332
3333 3333
3334 3334
3335 3335
3336 3336
3337 3337
3338 3338
3339 Three thousand three hundred thirty nine
334 334
335 335
336 336
337 337
338 338
339 Three hundred thirty nine
34 34
35 35
36 36
37 37
38 38
39 Thirty nine
4 4
5 5
6 6
7 7
8 8
9 nine
SELECT * FROM t1 PARTITION (subp3);
a b
3 3
6 6
9 nine
DELETE FROM t1 PARTITION (subp3);
SELECT * FROM t1;
a b
-1 -1
-2 -2
-3 -3
-4 -4
-5 -5
-6 -6
-7 -7
-8 -8
-9 negative nine
1 1
2 2
31 31
32 32
33 33
331 331
332 332
333 333
3331 3331
3332 3332
3333 3333
3334 3334
3335 3335
3336 3336
3337 3337
3338 3338
3339 Three thousand three hundred thirty nine
334 334
335 335
336 336
337 337
338 338
339 Three hundred thirty nine
34 34
35 35
36 36
37 37
38 38
39 Thirty nine
4 4
5 5
7 7
8 8
SELECT * FROM t1 PARTITION (subp3);
a b
DELETE FROM t1 PARTITION (`p0-29`);
SELECT * FROM t1;
a b
-1 -1
-2 -2
-3 -3
-4 -4
-5 -5
-6 -6
-7 -7
-8 -8
-9 negative nine
31 31
32 32
33 33
331 331
332 332
333 333
3331 3331
3332 3332
3333 3333
3334 3334
3335 3335
3336 3336
3337 3337
3338 3338
3339 Three thousand three hundred thirty nine
334 334
335 335
336 336
337 337
338 338
339 Three hundred thirty nine
34 34
35 35
36 36
37 37
38 38
39 Thirty nine
SELECT * FROM t1 PARTITION (`p0-29`);
a b
ALTER TABLE t1 PARTITION BY HASH (a) PARTITIONS 3;
DELETE FROM t1 PARTITION (p2);
SELECT * FROM t1;
a b
-1 -1
-3 -3
-4 -4
-6 -6
-7 -7
-9 negative nine
31 31
33 33
331 331
333 333
3331 3331
3333 3333
3334 3334
3336 3336
3337 3337
3339 Three thousand three hundred thirty nine
334 334
336 336
337 337
339 Three hundred thirty nine
34 34
36 36
37 37
39 Thirty nine
SELECT * FROM t1 PARTITION (p2);
a b
DROP TABLE t1;
#
# Test explicit partition selection on a non partitioned temp table
#
CREATE TEMPORARY TABLE t1 (a INT);
SELECT * FROM t1 PARTITION(pNonexisting);
ERROR HY000: PARTITION () clause on non partitioned table
DROP TEMPORARY TABLE t1;
#
# Test CREATE LIKE does not take PARTITION clause
#
CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 3;
CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (p0, p2)' at line 1
DROP TABLE t1;
SET @@default_storage_engine = @old_default_storage_engine;
#
# MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES
#
CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE);
CREATE TABLE t2 (i INT) ENGINE=MEMORY;
LOCK TABLE t1 WRITE, t2 WRITE;
SELECT * FROM t1 PARTITION (p0);
i
FLUSH TABLES;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 TRUNCATE PARTITION p0;
SELECT * FROM t1 PARTITION (p0);
i
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0);
i
UNLOCK TABLES;
DROP TABLE t1, t2;
#
# MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.
#
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=InnoDB PARTITION BY KEY(b) PARTITIONS 4;
INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6);
FLUSH TABLES;
UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3;
SELECT * FROM t1;
a b
2 0
7 8
2 4
2 4
0 7
4 3
8 2
2 6
DROP TABLE t1;
#
# MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge.
#
create table t1 (
pk int primary key,
a int,
b int,
filler char(32),
key (a),
key (b)
) engine=myisam partition by range(pk) (
partition p0 values less than (10),
partition p1 values less than MAXVALUE
) ;
insert into t1 select
seq,
MOD(seq, 100),
MOD(seq, 100),
'filler-data-filler-data'
from
seq_1_to_5000;
explain select * from t1 partition (p1) where a=10 and b=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where
flush tables;
select * from t1 partition (p1)where a=10 and b=10;
pk a b filler
10 10 10 filler-data-filler-data
110 10 10 filler-data-filler-data
210 10 10 filler-data-filler-data
310 10 10 filler-data-filler-data
410 10 10 filler-data-filler-data
510 10 10 filler-data-filler-data
610 10 10 filler-data-filler-data
710 10 10 filler-data-filler-data
810 10 10 filler-data-filler-data
910 10 10 filler-data-filler-data
1010 10 10 filler-data-filler-data
1110 10 10 filler-data-filler-data
1210 10 10 filler-data-filler-data
1310 10 10 filler-data-filler-data
1410 10 10 filler-data-filler-data
1510 10 10 filler-data-filler-data
1610 10 10 filler-data-filler-data
1710 10 10 filler-data-filler-data
1810 10 10 filler-data-filler-data
1910 10 10 filler-data-filler-data
2010 10 10 filler-data-filler-data
2110 10 10 filler-data-filler-data
2210 10 10 filler-data-filler-data
2310 10 10 filler-data-filler-data
2410 10 10 filler-data-filler-data
2510 10 10 filler-data-filler-data
2610 10 10 filler-data-filler-data
2710 10 10 filler-data-filler-data
2810 10 10 filler-data-filler-data
2910 10 10 filler-data-filler-data
3010 10 10 filler-data-filler-data
3110 10 10 filler-data-filler-data
3210 10 10 filler-data-filler-data
3310 10 10 filler-data-filler-data
3410 10 10 filler-data-filler-data
3510 10 10 filler-data-filler-data
3610 10 10 filler-data-filler-data
3710 10 10 filler-data-filler-data
3810 10 10 filler-data-filler-data
3910 10 10 filler-data-filler-data
4010 10 10 filler-data-filler-data
4110 10 10 filler-data-filler-data
4210 10 10 filler-data-filler-data
4310 10 10 filler-data-filler-data
4410 10 10 filler-data-filler-data
4510 10 10 filler-data-filler-data
4610 10 10 filler-data-filler-data
4710 10 10 filler-data-filler-data
4810 10 10 filler-data-filler-data
4910 10 10 filler-data-filler-data
DROP TABLE t1;
#
# End of 10.3 tests
#
#
# MDEV-18982: INSERT using explicit patition pruning with column list
#
create table t1 (a int) partition by hash(a);
insert into t1 partition (p0) (a) values (1);
select * from t1;
a
1
drop table t1;
#
# End of 10.4 tests
#
|