Skip to content

Feature Request: Support for PREWHERE operator in ActiveRecord chains #228

@vlad-storylane

Description

@vlad-storylane

Currently, the gem support only standard WHERE clause. However, ClickHouse significantly benefits from the PREWHERE clause, which is more efficient for performance as it filters data before reading the remaining columns.
I would like to be able to use .prewhere() in the same way as .where() in ActiveRecord chains.

Smth like:
User.prewhere(active: true).where(name: "Ivan") => SELECT * FROM users PREWHERE active = 1 WHERE name = 'Ivan'

ref: https://clickhouse.com/docs/sql-reference/statements/select/prewhere

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions