Re: Slow planning time for custom function - Mailing list pgsql-performance

From Andres Freund
Subject Re: Slow planning time for custom function
Date
Msg-id 20180324013552.lqrhlmywx42tg4oc@alap3.anarazel.de
Whole thread Raw
In response to Slow planning time for custom function  (bk@e8s.de)
Responses Re: Slow planning time for custom function  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-performance
Hi,

On 2018-03-23 21:28:22 +0100, bk@e8s.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
bodycolumn, 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,
Iget 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


pgsql-performance by date:

Previous
From: Peter
Date:
Subject: functions: VOLATILE performs better than STABLE
Next
From: David Rowley
Date:
Subject: Re: Slow planning time for custom function