FeatureFuel
1

Incorrect datetime format when using $NOW with mariadb

Source: directus/directus#24878 · opened by @SeanDylanGoff
Describe the Bug


Queries using $NOW (in my case filter with field _gt $NOW) lead to the following mariadb warning:

Truncated incorrect datetime value: '2023-05-16T22:33:06.412Z'

while this doesn't seem too serious it actually causes very slow queries in some specific cases.

To Reproduce


start directus with mariadb, filter a sufficiently large table (mine has 30k items) using $NOW. Simultaneously run show full processlist;.
You will notice a long running query like select table.id, ... from table where ((table.time_field > '2023-05-19T13:26:00.087Z')).

This query will generate a warning when run manually, and run very slow.
The issue seems to be the trailing "Z" as removing it leads to a speedup of 1000x (5s to 5ms) in my case.

Directus Version


v9.21.0 (can test on 10 in 1-2 days)

Hosting Strategy


Self-Hosted (Docker Image)

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests