[ 
https://issues.apache.org/jira/browse/IGNITE-16920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17538856#comment-17538856
 ] 

Vladimir Steshin edited comment on IGNITE-16920 at 5/18/22 2:02 PM:
--------------------------------------------------------------------

Calcite doesn't use index like H2. There is IGNITE-13919 already.

*H2:*
{code:java}
H2TreeIndex::getRowCount()

public long InlineIndexImpl::count(int segment, IndexQueryContext qryCtx) 
throws IgniteCheckedException {
   return segments[segment].size(filterClosure(qryCtx));
}

metaPage -> records number
{code}
And sums the counts from the index segments.


*Calcite:*
{code:java}
IgniteReduceHashAggregate(group=[{}], COUNT(*)=[COUNT()])
  IgniteExchange(distribution=[single])
    IgniteMapHashAggregate(group=[{}], COUNT(*)=[COUNT()])
      IgniteTableScan(table=[[PUBLIC, PI_COM_DAY]])
{code}


was (Author: vladsz83):
Calcite doesn't use index, counting records in metapages like H2. There is 
IGNITE-13919 already.

What H2 does:
{code:java}
H2TreeIndex::getRowCount()

public long InlineIndexImpl::count(int segment, IndexQueryContext qryCtx) 
throws IgniteCheckedException {
   return segments[segment].size(filterClosure(qryCtx));
}

metaPage -> records number
{code}
And sums the counts from the index segments.


Calcite:

{code:java}
IgniteReduceHashAggregate(group=[{}], COUNT(*)=[COUNT()])
  IgniteExchange(distribution=[single])
    IgniteMapHashAggregate(group=[{}], COUNT(*)=[COUNT()])
      IgniteTableScan(table=[[PUBLIC, PI_COM_DAY]])
{code}



> Calcite Engine. COUNT() lacks optimization.
> -------------------------------------------
>
>                 Key: IGNITE-16920
>                 URL: https://issues.apache.org/jira/browse/IGNITE-16920
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 2.13
>            Reporter: YuJue Li
>            Priority: Major
>              Labels: calcite2-required, calcite3-required
>             Fix For: 2.14
>
>         Attachments: PI_COM_DAY.sql, example-calcite.xml, 
> image-2022-05-01-13-35-59-275.png
>
>
> !image-2022-05-01-13-35-59-275.png!



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to