Re: Trim performance on 9.5

From: Vincent Elschot <vinny(at)xs4all(dot)nl>
To: William Ivanski <william(dot)ivanski(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trim performance on 9.5
Date: 2016-11-20 08:12:47
Message-ID: e399ba1d-60ad-d367-b7f9-e4892a9694f7@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Op 18/11/2016 om 16:58 schreef William Ivanski:
> I just ran EXPLAIN ANALYZE, please see images attached. Field doesn't
> have a index.
>
> Em sex, 18 de nov de 2016 às 12:16, vinny <vinny(at)xs4all(dot)nl
> <mailto:vinny(at)xs4all(dot)nl>> escreveu:
>
> On 2016-11-18 15:06, William Ivanski wrote:
> > Hi,
> >
> > I recently did major improvements on perfomance on our routines by
> > simply removing the call for trim functions on specific bottlenecks.
> > Please see images attached for a simple example.
> >
> > I'm using PostgreSQL version 9.5.5-1.pgdg80+1 on Debian 8.6. Someone
> > knows if it's a bug on trim function? Thanks in advance.
> >
> > --
> >
> > William Ivanski
>
> Did you run EXPLAIN on these queries?
>
> I'm guessing that you have an index on the field, but not on
> TRIM(field),
> which would mean that the database is forced to seqscan to fetch every
> row value, trim it and then compare it.
>
> --
>
> William Ivanski
>

Neither exeution times are really "fast", I'd suggest creating an index
on the TRIM() version of the field.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kim Rose Carlsen 2016-11-20 09:35:55 Re: Strict min and max aggregate functions
Previous Message Guillaume Lelarge 2016-11-20 03:56:04 Re: Feature request: separate logging