Re: Patch: Write Amplification Reduction Method (WARM)
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
Robert Haas <robertmhaas@gmail.com>, Bruce Momjian <bruce@momjian.us>,
Jaime Casanova <jaime.casanova@2ndquadrant.com>, Haribabu Kommi <kommi.haribabu@gmail.com>,
Tomas Vondra <tomas.vondra@2ndquadrant.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-03-29T06:32:29Z
Lists: pgsql-hackers
On Wed, Mar 29, 2017 at 11:52 AM, Amit Kapila <amit.kapila16@gmail.com> wrote: > On Tue, Mar 28, 2017 at 10:35 PM, Pavan Deolasee > <pavan.deolasee@gmail.com> wrote: >> >> On Tue, Mar 28, 2017 at 7:04 PM, Amit Kapila <amit.kapila16@gmail.com> >> wrote: >>> >>> For such an heap insert, we will pass >>> the actual value of column to index_form_tuple during index insert. >>> However during recheck when we fetch the value of c2 from heap tuple >>> and pass it index tuple, the value is already in compressed form and >>> index_form_tuple might again try to compress it because the size will >>> still be greater than TOAST_INDEX_TARGET and if it does so, it might >>> make recheck fail. >>> >> >> Would it? I thought "if >> (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i]))" check should >> prevent that. But I could be reading those macros wrong. They are probably >> heavily uncommented and it's not clear what each of those VARATT_* macro do. >> > > That won't handle the case where it is simply compressed. You need > check like VARATT_IS_COMPRESSED to take care of compressed heap > tuples, but then also it won't work because heap_tuple_fetch_attr() > doesn't handle compressed tuples. You need to use > heap_tuple_untoast_attr() to handle the compressed case. Also, we > probably need to handle other type of var attrs. Now, If we want to > do all of that index_form_tuple() might not be the right place, we > probably want to handle it in caller or provide an alternate API. > Another related, index_form_tuple() has a check for VARATT_IS_EXTERNAL not VARATT_IS_EXTENDED, so may be that is cause of confusion for you, but as I mentioned even if you change the check heap_tuple_fetch_attr won't suffice the need. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Implement SortSupport for macaddr data type
- f90d23d0c518 10.0 cited
-
Simplify check of modified attributes in heap_update
- 2fd8685e7fd9 10.0 landed
-
Remove direct uses of ItemPointer.{ip_blkid,ip_posid}
- ce96ce60ca22 10.0 landed
-
Fix CatalogTupleInsert/Update abstraction for case of shared indstate.
- aedd554f84bb 10.0 landed
-
Provide CatalogTupleDelete() as a wrapper around simple_heap_delete().
- ab02896510e2 10.0 landed
-
Band-aid fix for incorrect use of view options as StdRdOptions.
- e3e66d8a9813 10.0 cited
-
Update visibility map in the second phase of vacuum.
- fdf9e21196a6 9.3.0 cited
-
Avoid having two copies of the HOT-chain search logic.
- 4da99ea4231e 9.2.0 cited
-
Postgres95 1.01 Distribution - Virgin Sources
- d31084e9d111 7.1.1 cited