Re: Why is a sort required for this query? (IS NULL predicate on leading key column)

2024-01-17 Thread Tom Lane
Jerry Brenner writes: > I'm wondering why a sort is required for this query, as the index should be > providing the required ordering to satisfy the ORDER BY clause. Does it > have to do with the IS NULL predicate on the leading key column in the > index? IS NULL is not seen as an equality condi

Re: Why is a sort required for this query? (IS NULL predicate on leading key column)

2024-01-17 Thread Jerry Brenner
Apologies for not including this in the original email. The other index, job_u_createtime_2cy0wgyqpani8, is on pc_job(CreateTime, Retired, Subtype, ID). The optimizer chooses Nested Loop when choosing that index, vs Hash Join when choosing the index in the first plan that I posted. It seems like

Why is a sort required for this query? (IS NULL predicate on leading key column)

2024-01-17 Thread Jerry Brenner
We are on 13.9. I'm wondering why a sort is required for this query, as the index should be providing the required ordering to satisfy the ORDER BY clause. Does it have to do with the IS NULL predicate on the leading key column in the index? There's an index, job_u_closedate_g9cdc6ghupib, on pc_j