Re: Datum values consistency within one query

2020-04-03 Thread Tom Lane
Paul Ramsey writes: > So, if I tested for VARATT_IS_EXTENDED(), and then for > VARATT_IS_EXTERNAL_ONDISK(attr) and then did > VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr), I could use va_valueid + > va_toastrelid as keys in the cache for things that passed that filter? I'm pretty sure

Re: Datum values consistency within one query

2020-04-03 Thread Paul Ramsey
> On Apr 2, 2020, at 4:30 PM, Tom Lane wrote: > > Paul Ramsey writes: >> Getting the datum value is really fast, so I can have a cache that >> keeps the latest detoasted object around, and update it when the datum >> changes, and store the cache information in the parent context. Like >> so:

Re: Datum values consistency within one query

2020-04-02 Thread Tom Lane
Paul Ramsey writes: > Getting the datum value is really fast, so I can have a cache that > keeps the latest detoasted object around, and update it when the datum > changes, and store the cache information in the parent context. Like > so: Jeez, no, not like that. You're just testing a pointer.

Datum values consistency within one query

2020-04-02 Thread Paul Ramsey
Imagine a function that was going to take a table of, say, images, and so something to them over and over, like: SELECT pixel_count(img), clr_name, img_name FROM images img CROSS JOIN colors clr When you run this function, you find that a great amount of time is being spend in the