Hannu Krosing <hannu(at)skype(dot)net> writes:
> Where in the source is the decision about the placement new tuple (on
> which page to put it) made ?
RelationGetBufferForTuple() and the free space map
src/backend/access/heap/hio.c
src/backend/storage/freespace/freespace.c
> I'd like to take a look at adding "gravity" to that decision, do that I
> can make postgres to decide to place new tuple (inserted or updated)
> near the beginning of file,
I have strong doubts about this idea. The existing policy is designed
to reduce contention by having different backends inserting into
different pages.
regards, tom lane