yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.99k stars 1.07k forks source link

Skip building subdocument for some aggregate queries in DocDB #1850

Open JDNdeveloper opened 5 years ago

JDNdeveloper commented 5 years ago

Jira Link: DB-1655 Currently the query-layer-independent part of the DocDB scan is not aware of aggregate queries, and it wastes ~10% of total CPU time building subdocuments that will be immediately discarded. We should skip this step for queries that do not actually use the constructed subdocument.

There are some aggregate queries that will still need the subdocument values, like those that find the min/max or skip rows with null columns, so we can only skip building the subdocument in specific cases (like those seen in COUNT(*)).

bmatican commented 4 years ago

FYI @rajukumaryb this was one of the lower level types of optimizations I was mentioning offline for scan performance.