-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
area/sqlIssues or PRs related to SQLIssues or PRs related to SQLkind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Describe the bug
I found a slow query:
select k1 from mytable where Updatetime < unix_timestamp(date_format(now(), '%Y-%m-%d')) ;
It costs more than 5s.
The log in be.INFO is
{"query":{"match_all":{}},"stored_fields":"_none_","docvalue_fields":["k1","UpdateTime"],"sort":["_doc"],"size":4096}
i used another sql with the same meaning:
select k1 from mytable where Updatetime < 1589212800;
it costs less then 1s.
The log in be.INFO is
{"query":{"bool":{"filter":[{"bool":{"should":[{"range":{"UpdateTime":{"lt":"1589212800"}}}]}}]}},"stored_fields":"_none_","docvalue_fields":["k1","UpdateTime"],"sort":["_doc"],"size":4096}
I suspect that these basic functions (e.g. unix_timestamp(date_format(now(), '%Y-%m-%d'))) are not precomputed.
Version: Master
Metadata
Metadata
Assignees
Labels
area/sqlIssues or PRs related to SQLIssues or PRs related to SQLkind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.