-
Bug
-
-
Minor
-
Resolution:
Fixed
-
None
-
-
None
-
If we have a query which has
- regular ("cheap") constant condition that evaluates to FALSE
- an expensive constant condition (doesn't matter what it evaluates to)
then "Impossible WHERE" will not be generated.
Example:
create table t1 (a int);
|
insert into t1 values (1),(2),(3);
|
|
create table t2 as select * from t1;
|
|
create table t_pk1 (a int primary key);
|
create table t_pk2 (a int primary key);
|
|
insert into t_pk1 select a from t1;
|
insert into t_pk2 select a from t1;
|
|
alter table t_pk1 add b int;
|
alter table t_pk2 add b int;
|
## Here t_pk1 is a constant table, and "t_pk1.b> 3" is a cheap constant condition that evaluates to FALSE:
|
|
MariaDB [j10]> explain select * from t_pk1, t2 where t_pk1.a=2 and t_pk1.b> 3 ;
|
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
|
| 1 | SIMPLE | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE noticed after reading const tables |
|
+----+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
|
1 row in set (0.00 sec)
|
# Now, let's add an expensive constant condition, and observe that we won't be getting "Impossible WHERE" anymore:
|
|
MariaDB [j10]> explain select * from t_pk1, t2 where t_pk1.a=2 and t_pk1.b> 3 and 2 > (select max(a) from t1);
|
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------+
|
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
|
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------+
|
| 1 | PRIMARY | t_pk1 | const | PRIMARY | PRIMARY | 4 | const | 1 | |
|
| 1 | PRIMARY | t2 | ALL | NULL | NULL | NULL | NULL | 3 | |
|
| 2 | SUBQUERY | t1 | ALL | NULL | NULL | NULL | NULL | 3 | |
|
+----+-------------+-------+-------+---------------+---------+---------+-------+------+-------+
|
3 rows in set (0.00 sec)
|
{"report":{"fcp":802.5,"ttfb":189.5,"pageVisibility":"visible","entityId":21040,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"a6ff2c49-033d-4fcf-a957-02cdaf7ca4f5","navigationType":0,"readyForUser":890.3999999761581,"redirectCount":0,"resourceLoadedEnd":939.0999999642372,"resourceLoadedStart":196.0999999642372,"resourceTiming":[{"duration":43.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":196.0999999642372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":196.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":239.29999995231628,"responseStart":0,"secureConnectionStart":0},{"duration":43.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":196.39999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":196.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":239.5,"responseStart":0,"secureConnectionStart":0},{"duration":96.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":196.5999999642372,"connectEnd":196.5999999642372,"connectStart":196.5999999642372,"domainLookupEnd":196.5999999642372,"domainLookupStart":196.5999999642372,"fetchStart":196.5999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":196.5999999642372,"responseEnd":292.7999999523163,"responseStart":292.7999999523163,"secureConnectionStart":196.5999999642372},{"duration":180.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":196.79999995231628,"connectEnd":196.79999995231628,"connectStart":196.79999995231628,"domainLookupEnd":196.79999995231628,"domainLookupStart":196.79999995231628,"fetchStart":196.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":196.79999995231628,"responseEnd":377.2999999523163,"responseStart":377.2999999523163,"secureConnectionStart":196.79999995231628},{"duration":184.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":196.89999997615814,"connectEnd":196.89999997615814,"connectStart":196.89999997615814,"domainLookupEnd":196.89999997615814,"domainLookupStart":196.89999997615814,"fetchStart":196.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":196.89999997615814,"responseEnd":381.7999999523163,"responseStart":381.69999998807907,"secureConnectionStart":196.89999997615814},{"duration":186.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":197.19999998807907,"connectEnd":197.19999998807907,"connectStart":197.19999998807907,"domainLookupEnd":197.19999998807907,"domainLookupStart":197.19999998807907,"fetchStart":197.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":197.19999998807907,"responseEnd":383.5999999642372,"responseStart":383.5999999642372,"secureConnectionStart":197.19999998807907},{"duration":188.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":197.29999995231628,"connectEnd":197.29999995231628,"connectStart":197.29999995231628,"domainLookupEnd":197.29999995231628,"domainLookupStart":197.29999995231628,"fetchStart":197.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":197.29999995231628,"responseEnd":385.5999999642372,"responseStart":385.5999999642372,"secureConnectionStart":197.29999995231628},{"duration":237.19999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":197.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":197.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":434.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":189.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":197.5999999642372,"connectEnd":197.5999999642372,"connectStart":197.5999999642372,"domainLookupEnd":197.5999999642372,"domainLookupStart":197.5999999642372,"fetchStart":197.5999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":197.5999999642372,"responseEnd":387.19999998807907,"responseStart":387.19999998807907,"secureConnectionStart":197.5999999642372},{"duration":237.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":197.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":197.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":434.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":191,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":198,"connectEnd":198,"connectStart":198,"domainLookupEnd":198,"domainLookupStart":198,"fetchStart":198,"redirectEnd":0,"redirectStart":0,"requestStart":198,"responseEnd":389,"responseStart":389,"secureConnectionStart":198},{"duration":591,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":198.69999998807907,"connectEnd":198.69999998807907,"connectStart":198.69999998807907,"domainLookupEnd":198.69999998807907,"domainLookupStart":198.69999998807907,"fetchStart":198.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":198.69999998807907,"responseEnd":789.6999999880791,"responseStart":789.6999999880791,"secureConnectionStart":198.69999998807907},{"duration":591.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":198.79999995231628,"connectEnd":198.79999995231628,"connectStart":198.79999995231628,"domainLookupEnd":198.79999995231628,"domainLookupStart":198.79999995231628,"fetchStart":198.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":198.79999995231628,"responseEnd":790.5,"responseStart":790.5,"secureConnectionStart":198.79999995231628},{"duration":153.30000001192093,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":446.0999999642372,"connectEnd":446.0999999642372,"connectStart":446.0999999642372,"domainLookupEnd":446.0999999642372,"domainLookupStart":446.0999999642372,"fetchStart":446.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":446.0999999642372,"responseEnd":599.3999999761581,"responseStart":599.3999999761581,"secureConnectionStart":446.0999999642372},{"duration":204.80000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":719.3999999761581,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":719.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":924.1999999880791,"responseStart":0,"secureConnectionStart":0},{"duration":213,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":720.3999999761581,"connectEnd":720.3999999761581,"connectStart":720.3999999761581,"domainLookupEnd":720.3999999761581,"domainLookupStart":720.3999999761581,"fetchStart":720.3999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":720.3999999761581,"responseEnd":933.3999999761581,"responseStart":933.3999999761581,"secureConnectionStart":720.3999999761581},{"duration":218.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":720.6999999880791,"connectEnd":720.6999999880791,"connectStart":720.6999999880791,"domainLookupEnd":720.6999999880791,"domainLookupStart":720.6999999880791,"fetchStart":720.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":720.6999999880791,"responseEnd":939.0999999642372,"responseStart":939.0999999642372,"secureConnectionStart":720.6999999880791},{"duration":156.10000002384186,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":794.0999999642372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":794.0999999642372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":950.1999999880791,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":25,"responseStart":190,"responseEnd":194,"domLoading":194,"domInteractive":957,"domContentLoadedEventStart":957,"domContentLoadedEventEnd":998,"domComplete":1654,"loadEventStart":1654,"loadEventEnd":1655,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":937.1999999880791},{"name":"bigPipe.sidebar-id.end","time":937.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":938.0999999642372},{"name":"bigPipe.activity-panel-pipe-id.end","time":940.5},{"name":"activityTabFullyLoaded","time":1013.3999999761581}],"measures":[],"correlationId":"d237a6a9c8a8f5","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":95,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}