Filter with expression index on timestamptz field for Postgres

Due to performance reasons, we set up an expression index on our table in our Postgres database.

The column send_date is of type timestamptz, but due to performance reasons we built the index with an expression:

(user_id, date(timezone('UTC'::text, send_date)) DESC NULLS LAST)

Effectively now I have to query:

SELECT
  *
FROM
  emails
WHERE
  date(timezone('UTC', send_date)) > '2019-12-21'

Is there a possibility to change the column type or add a virtual column that applied this expression?

Or should I go for a view in Postgres then?

Hi @chululian
I would go with a View.
If I understand correctly, you’re asking if Metabase has timezone settings at a column level? Currently no, but there’s a feature request:
https://github.com/metabase/metabase/issues/6439 - upvote by clicking :+1: on the first post

1 Like