Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL] Support for pushdown of aggregate queries #1851

Closed
JDNdeveloper opened this issue Jul 19, 2019 · 0 comments
Closed

[YSQL] Support for pushdown of aggregate queries #1851

JDNdeveloper opened this issue Jul 19, 2019 · 0 comments
Assignees
Labels
area/ysql Yugabyte SQL (YSQL)
Projects

Comments

@JDNdeveloper
Copy link
Contributor

JDNdeveloper commented Jul 19, 2019

In CQL we currently pushdown aggregate queries (count/max/min) to DocDB, whereas in YSQL we retrieve all rows and leave it up to Postgres to perform the aggregation. This significantly impacts YSQL aggregate query performance as it has a prefetch limit of 1024 rows, so there is more RPC overhead. This issue tracks adding YSQL pushdown of aggregate queries to DocDB.

@JDNdeveloper JDNdeveloper added the area/ysql Yugabyte SQL (YSQL) label Jul 19, 2019
@JDNdeveloper JDNdeveloper self-assigned this Jul 19, 2019
@JDNdeveloper JDNdeveloper added this to To do in YSQL via automation Jul 19, 2019
@JDNdeveloper JDNdeveloper moved this from To do to In progress in YSQL Jul 19, 2019
@JDNdeveloper JDNdeveloper moved this from In progress to To do in YSQL Jul 24, 2019
@JDNdeveloper JDNdeveloper moved this from To do to In progress in YSQL Aug 20, 2019
@JDNdeveloper JDNdeveloper changed the title [YSQL] Support for pushdown of count aggregate queries [YSQL] Support for pushdown of aggregate queries Aug 20, 2019
JDNdeveloper added a commit that referenced this issue Sep 21, 2019
Summary:
This adds support for aggregate pushdowns to DocDB for COUNT/MAX/MIN/SUM. There are various conditions where we will not pushdown the aggregate, such as when predicates are present or non-pushdown supported aggregates are present (e.g. AVG, at least for now).

We pushdown if the following conditions are met:
- Outer plan is a YB foreign scan.
- No `WHERE` clause.
- No `ORDER BY`, `GROUP BY`, `DISTINCT`, or `FILTER`.
- Aggregates are one of: `COUNT`/`MIN`/`MAX`/`SUM`.
- Aggregate output type (i.e. transition type) is a supported YB key type and not a postgres internal or numeric type.
- Column type is a supported YB key type.

**Performance numbers:**

MIN(col02), 10M rows, RF 1, 2 integer cols.
- Without change (with default 1024 prefetch limit): 58.6s
- Without change (with 5M prefetch limit): 54.4s
- With change (with default 1024 prefetch limit): 52.2s
- With change (with 5M prefetch limit): 52.4s
- Speedup (with default 1024 prefetch limit): 10.9%

MIN(col02), 1M rows, RF 1, 2 integer cols.
- Without change: 5.7s
- With change: 5.1s
- Speedup: 10.5%

MIN(col02), 1M rows, RF 1, 10 integer cols.
- Without change: 7.7s
- With change: 7.1s
- Speedup: 7.8%

MIN(col02), 1M rows, RF 3, 10 integer cols.
- Without change: 7.5s
- With change: 6.7s
- Speedup: 10.6%

Test Plan:
Added existing postgres aggregates.sql regress test as yb_pg_aggregates.sql.

Will add a Java test to verify that supported aggregate queries are indeed being pushed down, and unsupported queries are not pushed down.

Reviewers: neha, mihnea, neil

Reviewed By: neil

Subscribers: karthik, kannan, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D7174
YSQL automation moved this from In progress to Done Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL)
Projects
YSQL
  
Done
Development

No branches or pull requests

1 participant