Re: Slow planning time for custom function

From: Andres Freund <andres(at)anarazel(dot)de>
To: bk(at)e8s(dot)de
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Slow planning time for custom function
Date: 2018-03-24 01:35:52
Message-ID: 20180324013552.lqrhlmywx42tg4oc@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

On 2018-03-23 21:28:22 +0100, bk(at)e8s(dot)de wrote:
> I have a table api.issues that has a text column "body" with long texts (1000+ chars). I also wrote a custom function "normalizeBody" with plv8 that is a simple Text -> Text conversion. Now I created an index applying the function to the body column, so I can quickly run
>
> SELECT * FROM api.issues WHERE normalizeBody(body) = normalizeBody($1)
>
> The issue is, that the planning time is very slow (1.8 seconds). When I replace "normalizeBody" with "md5", however, I get a planning time of 0.5ms.

How long does planning take if you repeat this? I wonder if a good chunk
of those 1.8s is initial loading of plv8.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Rowley 2018-03-24 01:52:29 Re: Slow planning time for custom function
Previous Message Peter 2018-03-24 01:27:47 functions: VOLATILE performs better than STABLE