0

I have a long (and long running, ~30min depending on load) query. It has multiple statements UNION'ed together. Most of the statements are using the GETDATE function[1].

  1. Is the function executed once or multiple times?
  2. If multiple times, would putting it into a WITH statement and then SELECT timestamp FROM <WITH statement> making it getting executed only once?

[1] https://docs.aws.amazon.com/redshift/latest/dg/r_GETDATE.html

2
  • The overhead of calling getdate() is so small that you shouldn't worry
    – user1822
    Commented Mar 24, 2020 at 6:11
  • It's not the overhead I am concerned about, but whether I am getting the same timestamp in all subqueries or not. The documentation doesn't say anything about it.
    – kev
    Commented Mar 24, 2020 at 10:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.