"Tomas Vondra" <tv@xxxxxxxx> writes: > Could the planner do this reasoning, i.e. see if there's a NOT NULL > constraint on the column and change the plan accordingly? Possibly. I'm not sure how expensive it would be. Right now, a structural change of that sort would have to be done pretty early in planning, and we don't have a lot of info collected about the tables at that point. I'm afraid it would involve a special-purpose catalog probe, which would add a lot of overhead. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general