Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How does postgres compare dates in WHERE clause?

Asked by Christopher Paterson Mar 15, 2023 1.9K views 1 answer
Share

About this question

I have a table with ~200 million rows that has a date column. I want to perform the following query.

select my_date from my_table 
where my_date > to_date('2020-10-01', 'YYYY-MM-DD');

As the query is executing, on each my_date in each row, the date value in the database will be compared with my string date cast into a date object. Is postgres smart enough to realise that this transformation from string to date object needs only to be performed once or will it execute with each row?

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.