title: Can postgres tell that some query will return nothing when there are mutually exclusive parts of the where clause?
body: <p>I'm working on optimizing a database backing an API that accepts timestamps in combinations to form ranges if desired. I've written some code to generate random queries, and have seen some performance degradation for queries that wound up with mutually exclusive times, e.g. `start_time &lt; '2022-03-31' and start_time &gt; '2022-03-31'. A query like this couldn't possibly return any rows (I don't think) and so I was wondering if there is a way for postgres to parse that mutual exclusion and skip scanning anything.</p>
  <p>With an index, the performance is fine to discover that there are no rows matching the conditions, but it still does an index scan and condition check. When I have an order by that doesn't match the conditions, then it really slows down. I was wondering if this is something missing from the query planner, or if I'm missing something key.</p>
  <p>I tried various combinations of indexes covering all the columns in the order alongside indexes on each individual column involved.</p>
  <p>I've searched here and on other sites, but either I couldn't come up with the right keywords or I just missed something.</p>