From: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Looping through string constants |
Date: | 2009-08-13 15:48:06 |
Message-ID: | 20090813154806.GD5407@samason.me.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Aug 13, 2009 at 08:30:07AM -0700, Scott Bailey wrote:
> >On Wed, Aug 12, 2009 at 08:45:58PM -0700, Scott Bailey wrote:
> >>CREATE OR REPLACE FUNCTION unnest(anyarray)
> >> RETURNS SETOF anyelement AS
> >>$BODY$
> >>SELECT $1[i] FROM
> >> generate_series(array_lower($1,1),
> >> array_upper($1,1)) i;
> >>$BODY$
> >> LANGUAGE 'sql' IMMUTABLE STRICT
> >
> >I'd recommend taking off the "STRICT" from this. It will, counter
> >intuitively, slow things down when you're not expecting it.
>
> Woah! Really? I use strict a lot when it doesn't make sense to process a
> function with a null param. Can you give me more details or point me to
> more reading on this issue? Thanks.
There have been a few to-and-fros between me and other people about
this. It's basically awkward interaction with the optimizer not being
able to expand this out because it may change behavior. Try:
http://archives.postgresql.org/pgsql-general/2009-06/msg00233.php
IMMUTABLE is good though, don't go removing that yet!
--
Sam http://samason.me.uk/
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2009-08-13 15:58:16 | Re: totally different plan when using partitions |
Previous Message | Scott Bailey | 2009-08-13 15:44:00 | Re: array syntax and geometric type syntax |