Re: [HACKERS] Index only scan for cube and seg
Hi! > 29 окт. 2017 г., в 2:24, Alexander Korotkov > написал(а): > > As I can see, cube GiST code always uses DatumGetNDBOX() macro to transform > Datum to (NDBOX *). > > #define DatumGetNDBOX(x) ((NDBOX *) PG_DETOAST_DATUM(x)) > > Thus, it should be safe to just remove both compress/decompress methods from > existing opclass. Alexander, Tom, you are absolutely right. I was sure there is toasting code in cube's compress, but it was not ever there. Here is patch for cube that drops functions. Best regards, Andrey Borodin. 0001-Enable-Index-Only-Scan-in-cube.patch Description: Binary data 0001-Enable-Index-Only-Scan-in-seg.patch Description: Binary data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Index only scan for cube and seg
On Fri, Oct 27, 2017 at 9:54 PM, Tom Lane wrote: > Robert Haas writes: > > On Thu, Oct 26, 2017 at 12:22 PM, Andrey Borodin > wrote: > >> For cube there is new default opclass. > > > I seem to recall that changing the default opclass causes unsolvable > > problems with upgrades. You might want to check the archives for > > previous discussions of this issue; unfortunately, I don't recall the > > details off-hand. > > Quite aside from that, replacing the opclass with a new one creates > user-visible headaches that I don't think are justified, i.e. having to > reconstruct indexes in order to get the benefit. > > Maybe I'm missing something, but ISTM you could just drop the compress > function and call it good. This would mean that an IOS scan would > sometimes hand back a toast-compressed value, but what's the problem > with that? > +1, I think in this case replacing default opclass or even duplicating opclass isn't justified. (The only reason for making a decompress function that just detoasts > is that your other support functions then do not have to consider > the possibility that they're handed a toast-compressed value. I have > not checked whether that really matters for cube.) > As I can see, cube GiST code always uses DatumGetNDBOX() macro to transform Datum to (NDBOX *). #define DatumGetNDBOX(x) ((NDBOX *) PG_DETOAST_DATUM(x)) Thus, it should be safe to just remove both compress/decompress methods from existing opclass. -- Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
Re: [HACKERS] Index only scan for cube and seg
Robert Haas writes: > On Thu, Oct 26, 2017 at 12:22 PM, Andrey Borodin wrote: >> For cube there is new default opclass. > I seem to recall that changing the default opclass causes unsolvable > problems with upgrades. You might want to check the archives for > previous discussions of this issue; unfortunately, I don't recall the > details off-hand. Quite aside from that, replacing the opclass with a new one creates user-visible headaches that I don't think are justified, i.e. having to reconstruct indexes in order to get the benefit. Maybe I'm missing something, but ISTM you could just drop the compress function and call it good. This would mean that an IOS scan would sometimes hand back a toast-compressed value, but what's the problem with that? (The only reason for making a decompress function that just detoasts is that your other support functions then do not have to consider the possibility that they're handed a toast-compressed value. I have not checked whether that really matters for cube.) regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Index only scan for cube and seg
On Thu, Oct 26, 2017 at 12:22 PM, Andrey Borodin wrote: > For cube there is new default opclass. I seem to recall that changing the default opclass causes unsolvable problems with upgrades. You might want to check the archives for previous discussions of this issue; unfortunately, I don't recall the details off-hand. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] Index only scan for cube and seg
Hi hackers! Here are patches enabling Index Only Scan for cube and seg extensions. These patches follow this discussion [0]. For cube there is new default opclass. We cannot drop old opclass, because it could TOAST come cube values in rare occasions. Index Only Scan is enabled only for newly created indexes. Btw I can add fetch to old opclass so that IOS would be enabled. For seg compress and decompress functions are dropped from opclass and extension. Index Only Scan is enabled. There are two more functions which can be deleted ghstore_decompress g_intbig_decompress But it will not lead to any feasible consequences. [0] https://www.postgresql.org/message-id/flat/CAJEAwVELVx9gYscpE%3DBe6iJxvdW5unZ_LkcAaVNSeOwvdwtD%3DA%40mail.gmail.com#CAJEAwVELVx9gYscpE=Be6iJxvdW5unZ_LkcAaVNSeOwvdwtD=a...@mail.gmail.com 0001-Create-cube-opclass-without-toasting.patch Description: Binary data 0001-Enable-Index-Only-Scan-in-seg.patch Description: Binary data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers