On Sat, Mar 24, 2007 at 02:00:30PM -0400, Tom Lane wrote:
> I had an idea about how to make this cleaner and faster at
> the same time. Make all snapshots be real pointers to
> SnapshotData structures (except InvalidSnapshot, which remains
> an alias for NULL). Add a struct field that is a pointer to
> the satifies function for the snapshot type. Then
> HeapTupleSatisfiesVisibility reduces to something like
>
> ((*(snapshot)->satisfies) ((tuple)->t_data, snapshot, buffer))
>
> which ought to be faster than it is now. We could also add
> an "mvcc" bool field to simplify IsMVCCSnapshot() --- or just
> make it test the contents of the satisfies-function field.
Sounds like a winner. Essentially snapshots becomes objects that have
methods you can use to interact with them. Make a new shapshot type,
most of the code doesn't need to care.
So yep, good idea.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.