Re: Tid scan improvements
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Edmund Horner <ejrh00@gmail.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>, tomas.vondra@2ndquadrant.com,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2018-12-21T18:10:52Z
Lists: pgsql-hackers
BTW, with respect to this bit in 0001:
@@ -1795,6 +1847,15 @@ nulltestsel(PlannerInfo *root, NullTestType nulltesttype, Node *arg,
return (Selectivity) 0; /* keep compiler quiet */
}
}
+ else if (vardata.var && IsA(vardata.var, Var) &&
+ ((Var *) vardata.var)->varattno == SelfItemPointerAttributeNumber)
+ {
+ /*
+ * There are no stats for system columns, but we know CTID is never
+ * NULL.
+ */
+ selec = (nulltesttype == IS_NULL) ? 0.0 : 1.0;
+ }
else
{
/*
I'm not entirely sure why you're bothering; surely nulltestsel is
unrelated to what this patch is about? And would anybody really
write "WHERE ctid IS NULL"?
However, if we do think it's worth adding code to cover this case,
I wouldn't make it specific to CTID. *All* system columns can be
assumed not null, see heap_getsysattr().
regards, tom lane
Commits
-
Add TID Range Scans to support efficient scanning ranges of TIDs
- bb437f995d47 14.0 landed
-
Improve planner's selectivity estimates for inequalities on CTID.
- f7111f72d2fd 12.0 landed