[
https://issues.apache.org/jira/browse/IGNITE-21372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-21372:
--------------------------------------
Description:
{code:java}
sql("CREATE TABLE t2 (id INTEGER PRIMARY KEY, val INTEGER)");
// query that always returns no data:
sql("SELECT * FROM t2 WHERE id IS NULL");
// Plan
IgniteExchange(distribution=[single]): id = 28
IgniteTableScan(table=[[PUBLIC, T2]], tableId=[8], *filters=[false]*,
requiredColumns=[{0, 1}]): id = 25
{code}
Although the optimizer is able deduce that `id is NULL` is always false, since
id is not nullable, and converted a predicate FALSE, the execution engine still
runs such a query.
It is possible reduce plans that are guaranteed to produce no results to some
form of an empty plan, so that the execution engine won't run them and return
an empty cursor instead.
was:
{code:java}
sql("CREATE TABLE t2 (id INTEGER PRIMARY KEY, val INTEGER)");
// query that always returns no data:
sql("SELECT * FROM t2 WHERE id IS NULL");
// Plan
IgniteExchange(distribution=[single]): rowcount = 2500.0, cumulative cost =
IgniteCost [rowCount=12500.0, cpu=42500.0, memory=0.0, io=0.0,
network=20000.0], id = 28
IgniteTableScan(table=[[PUBLIC, T2]], tableId=[8], *filters=[false]*,
requiredColumns=[{0, 1}]): rowcount = 2500.0, cumulative cost = IgniteCost
[rowCount=10000.0, cpu=40000.0, memory=0.0, io=0.0, network=0.0], id = 25
{code}
Although the optimizer is able deduce that `id is NULL` is always false, since
id is not nullable, and converted a predicate FALSE, the execution engine still
runs such a query.
It is possible reduce plans that are guaranteed to produce no results to some
form of an empty plan, so that the execution engine won't run them and return
an empty cursor instead.
> Sql. Do not execute queries that guaranteed to return no results.
> -----------------------------------------------------------------
>
> Key: IGNITE-21372
> URL: https://issues.apache.org/jira/browse/IGNITE-21372
> Project: Ignite
> Issue Type: Improvement
> Components: sql
> Affects Versions: 3.0.0-beta2
> Reporter: Maksim Zhuravkov
> Priority: Minor
>
> {code:java}
> sql("CREATE TABLE t2 (id INTEGER PRIMARY KEY, val INTEGER)");
> // query that always returns no data:
> sql("SELECT * FROM t2 WHERE id IS NULL");
> // Plan
> IgniteExchange(distribution=[single]): id = 28
> IgniteTableScan(table=[[PUBLIC, T2]], tableId=[8], *filters=[false]*,
> requiredColumns=[{0, 1}]): id = 25
> {code}
> Although the optimizer is able deduce that `id is NULL` is always false,
> since id is not nullable, and converted a predicate FALSE, the execution
> engine still runs such a query.
> It is possible reduce plans that are guaranteed to produce no results to some
> form of an empty plan, so that the execution engine won't run them and return
> an empty cursor instead.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)