Open
Description
For the following query (PostgresSwitch4):
SELECT data
FROM github.pulls
WHERE (to_timestamp((data->>'created_at')::text, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') >= NOW() - INTERVAL '3 months')
LIMIT 10;
Why is it cast from text to timestamp and then back to text?
The problem is that this function is not immutable and cannot be indexed.
With the followingquery, an index on github.pulls ((data->>'created_at') asc)
could be used
SELECT data
FROM github.pulls
WHERE data->>'created_at' >= to_char(NOW() - INTERVAL '3 months','YYYY-MM-DD"T"HH24:MI:SS"Z"')
LIMIT 10;
Metadata
Metadata
Assignees
Labels
No labels