Time Filter for PostgreSQL Datasource

Hi,

Could anyone please show me a way to add time filter for the PostgreSQL queries, so that the data fetch limits to the time range selected in the dashboard. Currently, I am not using any time filter macros in the queries, so it fetches whole data from the beginning to latest. It takes too much time to load a single panel itself. I tried some time filter macros like $__timeFilter(), $__unixEpochFilter(), $__unixEpochNanoFilter(), etc. But all the queries return either an error or no data. Please help to fix this issue.

Thank you.