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
|
# Tests for delete with INNODB
#
# MDEV-22187: SIGSEGV in ha_innobase::cmp_ref on DELETE
#
SET @save_sort_buffer_size= @@sort_buffer_size;
SET sort_buffer_size=1024;
CREATE TABLE t1(c1 CHAR(255) PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0), ('a'), ('b');
ANALYZE TABLE t1 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1;
c1
0
a
b
EXPLAIN DELETE b FROM t1 AS a JOIN t1 AS b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE a ALL NULL NULL NULL NULL 3
1 SIMPLE b ALL NULL NULL NULL NULL 3
DELETE b FROM t1 AS a JOIN t1 AS b;
SELECT * FROM t1;
c1
SET sort_buffer_size=@save_sort_buffer_size;
DROP TABLE t1;
#
# MDEV-35944 DELETE fails to notice transaction abort, violating ACID
#
CREATE TABLE t1 (id INT PRIMARY KEY, col_varchar VARCHAR(8)) ENGINE=InnoDB;
INSERT INTO t1 (id) VALUES (1),(2);
CREATE TABLE t2 (id INT, f INT, s DATE, e DATE, PERIOD FOR p(s,e), PRIMARY KEY(id, p WITHOUT OVERLAPS)) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,0,'2000-01-01','2000-01-02');
CREATE TABLE t3 (id INT, f BLOB, UNIQUE(f)) ENGINE=InnoDB;
connection default;
SET innodb_lock_wait_timeout=1;
START TRANSACTION;
DELETE FROM t1;
connect con1,localhost,root,,;
START TRANSACTION;
UPDATE t2 SET f = 20;
connection default;
DELETE FROM t2 FOR PORTION OF p FROM '2000-01-01' TO '2000-01-02';
connection con1;
INSERT INTO t3 (id) VALUES (1), (2);
UPDATE t1 SET col_varchar = 'bar';
COMMIT;
connection default;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
UPDATE t3 SET f = 'foo' ORDER BY f LIMIT 1;
DROP TABLE t1, t2, t3;
# End of 10.5 tests
#
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
c1
1
3
4
5
6
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
select * from t1;
c1
1
3
4
5
6
truncate t2;
INSERT INTO t2 values (3);
disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 2.00 100.00 100.00 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 50.00 Using where; FirstMatch(t1)
select * from t1;
c1
1
4
5
6
DROP TABLE t1, t2;
#
# MDEV-33533: multi-delete using rowid filter
#
set @save_default_storage_engine=@@default_storage_engine;
set default_storage_engine=InnoDB;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
create index i_n_name on nation(n_name);
analyze table
nation, lineitem, customer, orders, part, supplier, partsupp, region
persistent for all;
Table Op Msg_type Msg_text
dbt3_s001.nation analyze status Engine-independent statistics collected
dbt3_s001.nation analyze status OK
dbt3_s001.lineitem analyze status Engine-independent statistics collected
dbt3_s001.lineitem analyze status OK
dbt3_s001.customer analyze status Engine-independent statistics collected
dbt3_s001.customer analyze status OK
dbt3_s001.orders analyze status Engine-independent statistics collected
dbt3_s001.orders analyze status OK
dbt3_s001.part analyze status Engine-independent statistics collected
dbt3_s001.part analyze status OK
dbt3_s001.supplier analyze status Engine-independent statistics collected
dbt3_s001.supplier analyze status OK
dbt3_s001.partsupp analyze status Engine-independent statistics collected
dbt3_s001.partsupp analyze status OK
dbt3_s001.region analyze status Engine-independent statistics collected
dbt3_s001.region analyze status OK
explain
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE nation ref PRIMARY,i_n_name i_n_name 101 const 1 Using where; Using index
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
1 SIMPLE orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter
explain format=json
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "nation",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_n_name"],
"key": "i_n_name",
"key_length": "101",
"used_key_parts": ["n_name"],
"ref": ["const"],
"loops": 1,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "nation.n_name = 'PERU'",
"using_index": true
}
},
{
"table": {
"table_name": "customer",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_c_nationkey"],
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"ref": ["dbt3_s001.nation.n_nationkey"],
"loops": 1,
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_orderdate", "i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3_s001.customer.c_custkey"],
"rowid_filter": {
"range": {
"key": "i_o_orderdate",
"used_key_parts": ["o_orderDATE"]
},
"rows": 119,
"selectivity_pct": 7.933333333
},
"loops": 6,
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 7.933333397,
"attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'"
}
}
]
}
}
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
create table t as
select orders.* from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
explain
delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE nation ref PRIMARY,i_n_name i_n_name 101 const 1 Using where; Using index
1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
1 SIMPLE orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter
explain format=json
delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "nation",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_n_name"],
"key": "i_n_name",
"key_length": "101",
"used_key_parts": ["n_name"],
"ref": ["const"],
"loops": 1,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "nation.n_name = 'PERU'",
"using_index": true
}
},
{
"table": {
"table_name": "customer",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_c_nationkey"],
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"ref": ["dbt3_s001.nation.n_nationkey"],
"loops": 1,
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_orderdate", "i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3_s001.customer.c_custkey"],
"rowid_filter": {
"range": {
"key": "i_o_orderdate",
"used_key_parts": ["o_orderDATE"]
},
"rows": 119,
"selectivity_pct": 7.933333333
},
"loops": 6,
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 7.933333397,
"attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'"
}
}
]
}
}
delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
insert into orders select * from t;
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
prepare stmt from "
delete from orders using orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
";
execute stmt;
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
insert into orders select * from t;
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
execute stmt;
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
insert into orders select * from t;
select o_orderkey, o_totalprice from orders, customer, nation where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey = c_custkey and
c_nationkey = n_nationkey and
n_name='PERU';
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
deallocate prepare stmt;
drop table t;
explain
select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY nation ref PRIMARY,i_n_name i_n_name 101 const 1 Using where; Using index
1 PRIMARY customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
1 PRIMARY orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter
explain format=json
select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "nation",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_n_name"],
"key": "i_n_name",
"key_length": "101",
"used_key_parts": ["n_name"],
"ref": ["const"],
"loops": 1,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "nation.n_name = 'PERU'",
"using_index": true
}
},
{
"table": {
"table_name": "customer",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_c_nationkey"],
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"ref": ["dbt3_s001.nation.n_nationkey"],
"loops": 1,
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_orderdate", "i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3_s001.customer.c_custkey"],
"rowid_filter": {
"range": {
"key": "i_o_orderdate",
"used_key_parts": ["o_orderDATE"]
},
"rows": 119,
"selectivity_pct": 7.933333333
},
"loops": 6,
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 7.933333397,
"attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'"
}
}
]
}
}
select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
create table t as
select * from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
explain
delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY nation ref PRIMARY,i_n_name i_n_name 101 const 1 Using where; Using index
1 PRIMARY customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index
1 PRIMARY orders ref|filter i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (8%) Using where; Using rowid filter
explain format=json
delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "nation",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_n_name"],
"key": "i_n_name",
"key_length": "101",
"used_key_parts": ["n_name"],
"ref": ["const"],
"loops": 1,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "nation.n_name = 'PERU'",
"using_index": true
}
},
{
"table": {
"table_name": "customer",
"access_type": "ref",
"possible_keys": ["PRIMARY", "i_c_nationkey"],
"key": "i_c_nationkey",
"key_length": "5",
"used_key_parts": ["c_nationkey"],
"ref": ["dbt3_s001.nation.n_nationkey"],
"loops": 1,
"rows": 6,
"cost": "COST_REPLACED",
"filtered": 100,
"using_index": true
}
},
{
"table": {
"table_name": "orders",
"access_type": "ref",
"possible_keys": ["i_o_orderdate", "i_o_custkey"],
"key": "i_o_custkey",
"key_length": "5",
"used_key_parts": ["o_custkey"],
"ref": ["dbt3_s001.customer.c_custkey"],
"rowid_filter": {
"range": {
"key": "i_o_orderdate",
"used_key_parts": ["o_orderDATE"]
},
"rows": 119,
"selectivity_pct": 7.933333333
},
"loops": 6,
"rows": 15,
"cost": "COST_REPLACED",
"filtered": 7.933333397,
"attached_condition": "orders.o_orderDATE between '1992-01-01' and '1992-06-30'"
}
}
]
}
}
delete from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
o_orderkey o_totalprice
insert into orders select * from t;
select o_orderkey, o_totalprice from orders where o_orderDATE between '1992-01-01' and '1992-06-30' and
o_custkey in (select c_custkey from customer
where c_nationkey in (select n_nationkey from nation
where n_name='PERU'));
o_orderkey o_totalprice
1729 12137.76
2880 145761.99
3142 16030.15
5095 184583.99
5121 150334.57
5382 138423.03
644 201268.06
737 12984.85
drop table t;
DROP DATABASE dbt3_s001;
set default_storage_engine=@save_default_storage_engine;
#
# Additional tests of first table and rowid filter
#
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_default_storage_engine=@@default_storage_engine;
set default_storage_engine=InnoDB;
CREATE INDEX i_l_quantity ON lineitem(l_quantity);
CREATE INDEX i_o_totalprice ON orders(o_totalprice);
ANALYZE TABLE lineitem, orders;
Table Op Msg_type Msg_text
dbt3_s001.lineitem analyze status Engine-independent statistics collected
dbt3_s001.lineitem analyze status OK
dbt3_s001.orders analyze status Engine-independent statistics collected
dbt3_s001.orders analyze status OK
set optimizer_use_condition_selectivity=2;
create table second(s_receiptDATE date, filler char(100), key(s_receiptDATE)) ;
insert into second select date_add(l_receiptDATE, interval 1 day), 'helllo' from lineitem ;
select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day);
count(*)
114
# lineitem should be first and with "Using rowid filter"
explain delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range|filter i_l_shipdate,i_l_quantity i_l_quantity|i_l_shipdate 9|4 NULL 349 (8%) Using where; Using rowid filter
1 SIMPLE second ref s_receiptDATE s_receiptDATE 4 func 1 Using where; Using index
delete lineitem FROM lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day);
# Should be 0
select count(*) from lineitem, second WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND l_quantity > 47 and second.s_receiptDATE = date_add(l_receiptDATE, interval 1 day);
count(*)
0
drop database dbt3_s001;
set default_storage_engine=@save_default_storage_engine;
# End of 11.1 tests
|