1

I would like to know whether using the current_date or get_date() function on redshift SQL would lower the query performance compared to using '2016-05-05' directly, for example.

Example 1:

select * from table a where time >= current_date - 1 and time < current_date

Example 2:

select * from table a where time >='2016-05-08' and time < '2016-05-09'

Would example 1 or example 2 have better performance? Or would both have the same?

Hope someone could shed some light on it

zx485
  • 28,498
  • 28
  • 50
  • 59
hleslie
  • 11
  • 2

1 Answers1

0

I just ran up against this, so I shall share my anecdotal experience:

select * from table where ts > current_date limit 20 was running for 10+mins before I got impatient and killed it.

select * from table where ts > '2017-06-08' limit 20 completed in 16s.

table has a sort key on ts, and was freshly analyzed

user1315792
  • 3
  • 1
  • 2