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