Stephan Szabo wrote:
What I was mentioning was that I was pretty sure that there
was a message with someone saying that they actually tried something that
did this and that they found left-most varchar access was slightly slower
after the reordering although general access was faster. I believe the
table case was alternating smallint and varchar columns, but I don't know
what was tested for the retrieval. If that turns out to be able to be
supported by other tests, then for some access patterns, the rearranged
version might be slower.
I would want to see this very carefully instrumented. Assuming we are
putting all fixed size objects at the front, which seems like the best
arrangement, then the position of every fixed field and the fixed
portion of the position of every varlena field can be precalculated (and
in the case of the leftmost varlena field that's it's complete
position). So the extra effort in getting to the leftmost varchar field
should be close to zero if this is done right, ISTM.
cheers
andrew
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match