Re: Compressed TOAST Slicing

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Paul Ramsey" <pramsey(at)cleverelephant(dot)ca>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>,rafia(dot)sabih(at)enterprisedb(dot)com,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Stephen Frost" <sfrost(at)snowman(dot)net>,"PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Compressed TOAST Slicing
Date: 2019-02-20 19:12:18
Message-ID: eee6e817-29bd-451f-8105-2d4bb3e2aedc@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Paul Ramsey wrote:

> > text_starts_with(arg1,arg2) in varlena.c does a full decompression
> > of arg1 when it could limit itself to the length of the smaller arg2:
>
> Nice catch, I didn't find that one as it's not user visible, seems to
> be only called in spgist (!!)

It's also exposed in SQL since v11, as
starts_with(string,prefix) returns bool
and as an operator:
text ^@ text
I guess it's meant to be more efficient than (string LIKE prefix||'%')
or strpos(string,prefix)=1, and it will be even more so if we can
avoid some amount of decompression :)

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-02-20 19:35:27 Re: bgwriter_lru_maxpages limits in PG 10 sample conf
Previous Message Justin Pryzby 2019-02-20 18:55:52 BRIN summarize autovac_report_workitem passes datname as relname