Re: [HACKERS] Custom compression methods

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, David Steele <david(at)pgmasters(dot)net>, Ildus Kurbangaliev <i(dot)kurbangaliev(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [HACKERS] Custom compression methods
Date: 2021-02-20 09:15:09
Message-ID: CAFiTN-uahO8RPhE+EttqO+3LAkH-OM7qur-J8yZCM7Gv4qWsrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 20, 2021 at 11:04 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:

> Even after the above case, we might say it is still not a problem for
> this patch because even though t2 doesn't have a direct relationship
> with lz4 but it has an indirect relationship with lz4 via t1. So I
> think this particular case which I showed might not be a problem even
> for the custom compression method. However, I agree that the
> decompressing to survive COMMIT/ROLLBACK might be a problem for custom
> compression methods but not for the built-in method. So I agree with
> the conclusion that even if we don't make any changes to the
> "expandedrecord.c", it won't be a problem for the built-in methods.

I think I was wrong here, consider below scenario (Robert had sent
this test to me(offlist) for showing some other example, which I have
modified a bit to prove another point)

create table foo (a int, b text);
create table foo1 (a int, b text compression lz4);
insert into foo1 select 1, repeat('a', 3000);

create or replace function make_foo() returns foo as $$declare x foo;
begin
x.a = 1;
select b into x.b from foo1;
return x;
end$$ language plpgsql;

create table bar (f foo);
insert into bar select make_foo();
SELECT pg_column_compression((bar.f).b) FROM bar;
pg_column_compression
-----------------------
lz4
(1 row)

So basically, now table bar doesn't have any relation with foo1 and it
is still the row with compression method lz4. This issue is resolved
with my changes in
(v25_0001_Disallow_compressed_data_inside_container_types, in
expandedrecord.c). So the point is that for the built-in method also
we need changes related to expandedrecord at least the changes I made
where tuple are actually formed for inserting into the target.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-02-20 09:19:04 Re: Some regular-expression performance hacking
Previous Message Julien Rouhaud 2021-02-20 09:07:27 Re: Outdated description for effective_io_concurrency