Re: Slow planning time when public schema included (12 vs. 9.4)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anders Steinlein <anders(at)e5r(dot)no>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Slow planning time when public schema included (12 vs. 9.4)
Date: 2020-03-21 19:35:51
Message-ID: 4541.1584819351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Anders Steinlein <anders(at)e5r(dot)no> writes:
> On Sat, Mar 21, 2020 at 3:26 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Not sure why you'd not have seen the same effect in your 9.4
>> installation, but maybe you had citext installed somewhere else?

> The tables segments and contacts_lists are identical on the two instances,
> i.e. both are using citext (email domain using the citext type) on both 12
> and 9.4, with the citext extension in the public schema. Is it the
> lc_collate setting citext cares about? lc_collate=nb_NO.UTF-8 on both 9.4
> and 12.

I think it depends on both lc_collate and lc_ctype, since basically
what it's doing is lower() on each string and then a strcoll()
comparison. The strcoll() part should be pretty much equivalent to
text comparisons, though ... or, hmm, maybe not. texteq() knows
it can reduce that to just a memcmp bitwise-equality test, but
citext doesn't have that optimization.

> So I don't understand this big difference? Because it does seem like citext
> is indeed the difference.

It seems odd to me too. I'm not at all surprised that citext comparison
is way slower than text, but I am surprised that you don't see that on 9.4
as well. Is lc_ctype the same in both installs? For that matter, is the
underlying libc the same? We have seen large performance discrepancies
between different libc versions in this area.

If you're interested in digging further, getting a "perf" profile while
running the problem query over and over would likely yield some insight
about where the time is going.

https://wiki.postgresql.org/wiki/Profiling_with_perf

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Anders Steinlein 2020-03-21 21:13:37 Re: Slow planning time when public schema included (12 vs. 9.4)
Previous Message Anders Steinlein 2020-03-21 15:59:07 Re: Slow planning time when public schema included (12 vs. 9.4)