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

Low performance of queries with filters in YDB OLAP database #15868

Open
vitalyisaev2 opened this issue Mar 18, 2025 · 3 comments
Open

Low performance of queries with filters in YDB OLAP database #15868

vitalyisaev2 opened this issue Mar 18, 2025 · 3 comments
Labels
area/cs bug Something isn't working prio:high

Comments

@vitalyisaev2
Copy link
Member

The Cloud Logging connector performs parallel reading from three YDB OLAP databases located in different data centers. Queries containing timestamp filters catn take a very long time to complete. The query latency is between 1 sec and 7-8 minutes. The slowest responses are observed in VLA, however SAS and KLG can be slow as well.

Here is the list of Cloud Logging databases in pre-production environment:

  • /pre-prod_vla/yc.logs.cloud/cc8jliaf18k2b9ae2bio
  • /pre-prod_klg/yc.logs.cloud/cc817gnjjceirp80h587
  • /pre-prod_sas/yc.logs.cloud/cc8bajrmntk9q0d1lc0t

Example of YQ query executed against the Cloud Logging connection:

SELECT COUNT(*) FROM cloud_logging_connection.`cloud-trail` WHERE
    timestamp >= Timestamp("2025-03-11T18:00:00Z")
    AND
    timestamp <= Timestamp("2025-03-11T18:00:01Z");

The query above is transformed by Connector into the following YDB query:

PRAGMA TablePathPrefix("/pre-prod_klg/yc.logs.cloud/cc817gnjjceirp80h587");
DECLARE $p0 AS Timestamp;
DECLARE $p1 AS Bool;
DECLARE $p2 AS Timestamp;
DECLARE $p3 AS Bool;
SELECT `timestamp` FROM `logs/origin/aoeoqusjtbo4m549jrom/aoe3cidh5dfee2s6cqu5/af3731rdp83d8gd8fjcv` WHERE (COALESCE((`timestamp` >= $p0), $p1) AND COALESCE((`timestamp` <= $p2), $p3))

Query args: Arguments: ["2025-03-11T18:00:00Z", false, "2025-03-11T18:00:01Z", false]

@dorooleg dorooleg added the bug Something isn't working label Mar 18, 2025
@dorooleg
Copy link
Collaborator

В итоге выяснили что не работает push down через ReadRanges для COALESCE с параметром:
Явно проставлен второй аргумент в false:
Image

Через параметры:
Image

@dorooleg
Copy link
Collaborator

Из странного сам фильтр разложился в правильный range
Image

@dorooleg
Copy link
Collaborator

Еще нужно проверить что если не смогли сделать push down для ReadRanges, то на самом деле его можно завернуть в SSA программу с помощью которой можно пройтись по метаднным и отфильтровать данные

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cs bug Something isn't working prio:high
Projects
None yet
Development

No branches or pull requests

2 participants