Bug #58555 Crash in heap_scan_init at line 30 in hp_scan.c on nested subqueries in FROM
| Submitted: | 29 Nov 2010 10:38 | Modified: | 5 Jul 2011 18:26 |
|---|---|---|---|
| Reporter: | John Embretsen | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S1 (Critical) |
| Version: | bzr_WL5274 | OS: | Any |
| Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
| Tags: | wl5274 | ||
[29 Nov 2010 10:38]
John Embretsen
[29 Nov 2010 15:28]
John Embretsen
How to repeat (InnoDB is required):
CREATE TABLE t1 (
pk INT NOT NULL,
col_int_key INT,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key)
) ENGINE=InnoDB;
CREATE TABLE t2 (
pk INT NOT NULL,
col_int_key INT,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key)
) ENGINE=InnoDB;
CREATE TABLE t3 (
pk INT NOT NULL,
col_int_key INT,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key)
) ENGINE=InnoDB;
INSERT INTO t3 VALUES (13,NULL);
INSERT INTO t3 VALUES (14,4);
CREATE ALGORITHM=TEMPTABLE VIEW viewt1 AS SELECT * FROM t1;
CREATE ALGORITHM=TEMPTABLE VIEW viewt2 AS SELECT * FROM t2;
SELECT table1.pk AS field1
FROM
( SELECT viewt2.*
FROM
( viewt2
RIGHT OUTER JOIN t3
ON t3.pk = viewt2.col_int_key
)
) AS table1
WHERE ( table1.col_int_key NOT IN (
SELECT viewt1.pk
FROM viewt1
WHERE viewt1.pk >= viewt1.pk )
)
ORDER BY field1
LIMIT 10;
[29 Nov 2010 15:30]
John Embretsen
EXPLAIN output for the crashing query:
EXPLAIN SELECT table1.pk AS field1
FROM
( SELECT viewt2.*
FROM
( viewt2
RIGHT OUTER JOIN t3
ON t3.pk = viewt2.col_int_key
)
) AS table1
WHERE ( table1.col_int_key NOT IN (
SELECT viewt1.pk
FROM viewt1
WHERE viewt1.pk >= viewt1.pk )
)
ORDER BY field1
LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 Using where; Using filesort
3 DEPENDENT SUBQUERY <derived5> index_subquery auto_key0 auto_key0 4 func 2 Using where; Full scan on NULL key
5 DERIVED t1 index NULL col_int_key 5 NULL 1 Using index
2 DERIVED t3 index NULL col_int_key 5 NULL 2 Using index
2 DERIVED <derived4> ref auto_key0 auto_key0 5 test.t3.pk 2
4 DERIVED t2 index NULL col_int_key 5 NULL 1 Using index
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.