Skip to content

Scalar subqueries always executed even if not used #53752

Closed

Description

@UnamedRus

How to reproduce
23.3

WITH (
        SELECT sleepEachRow(2)
    ) AS res
SELECT *
FROM system.one

┌─dummy─┐
│     0 │
└───────┘
1 row in set. Elapsed: 2.002 sec.

WITH sleepEachRow(2) AS res
SELECT *
FROM system.one

┌─dummy─┐
│     0 │
└───────┘
1 row in set. Elapsed: 0.001 sec.

Additional context
Analyzer also doesn't help

SET  allow_experimental_analyzer=1;

Activity

  1. novikd commented on Sep 11, 2023

    @novikd
    Member

    Must be fixed for analyzer in #52947

  2. novikd commented on Feb 11, 2025

    @novikd
    Member

    @UnamedRus It is worth adding a test.

  3. reopened this on Feb 11, 2025
  4. added a commit that references this issue on Feb 11, 2025
  5. added a commit that references this issue on Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions