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

Push down optimizations in the query at the subquery level #43137

Open
paoliniluis opened this issue May 24, 2024 · 0 comments
Open

Push down optimizations in the query at the subquery level #43137

paoliniluis opened this issue May 24, 2024 · 0 comments
Labels
.Performance Querying/Nested Queries Questions based on other saved questions Type:New Feature

Comments

@paoliniluis
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The way we do nested questions keeps the fields of the subqueries static, but on columnar databases we should be only picking the columns we're using in the top level query

Describe the solution you'd like
If we're using columnar DB's, instead of

SELECT
  "source"."id" AS "id",
  "source"."rating" AS "rating",
  "source"."rating_mapped" AS "rating_mapped",
  "source"."body" AS "body"
FROM
  (
    SELECT
      "public"."feedback"."id" AS "id",
      "public"."feedback"."account_id" AS "account_id",
      "public"."feedback"."email" AS "email",
      "public"."feedback"."date_received" AS "date_received",
      "public"."feedback"."rating" AS "rating",
      "public"."feedback"."rating_mapped" AS "rating_mapped",
      "public"."feedback"."body" AS "body"
    FROM
      "public"."feedback"
  ) AS "source"
LIMIT
  1048575

the query should be

SELECT
  "source"."id" AS "id",
  "source"."rating" AS "rating",
  "source"."rating_mapped" AS "rating_mapped",
  "source"."body" AS "body"
FROM
  (
    SELECT
      "public"."feedback"."id" AS "id",
      "public"."feedback"."rating" AS "rating",
      "public"."feedback"."rating_mapped" AS "rating_mapped",
      "public"."feedback"."body" AS "body"
    FROM
      "public"."feedback"
  ) AS "source"
LIMIT
  1048575

Describe alternatives you've considered
None

How important is this feature to you?
NA

Additional context
NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Performance Querying/Nested Queries Questions based on other saved questions Type:New Feature
Projects
None yet
Development

No branches or pull requests

1 participant