current_date vs 'now'
От | Jamie Tufnell |
---|---|
Тема | current_date vs 'now' |
Дата | |
Msg-id | b0a4f3350902042205l6ba4f2c0u2545992fbb7e9088@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: current_date vs 'now'
|
Список | pgsql-sql |
Hi, I was doing EXPLAIN ANALYZE on a query where I compare against current_date and noticed the following: Filter: (date <= ('now'::text)::date) I knew about now() but did not know about 'now' and have since learnt of 'today', 'tomorrow', etc. Great! So, I changed my condition to <= 'now' to see if there would be any improvement, which changed the filter line to: Filter: (date <= '2009-02-05'::date) and without fail this query is 2ms quicker every time. I alternated between the two and ran them both several times to make sure it wasn't just a cache difference. AFAIK current_date is standard and 'now' and 'today', etc are not... so that's one reason to continuing using current_date. However, I wonder why 'today' and current_date don't generate the same query plan? Jamie
В списке pgsql-sql по дате отправления: