Re: String manipulation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: David Olbersen <DOlbersen(at)stbernard(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: String manipulation
Date: 2003-07-29 01:21:13
Message-ID: 17030.1059441673@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Joe Conway <mail(at)joeconway(dot)com> writes:
> SELECT substring(path from position(' ' in path) + 1) FROM (SELECT
> split_part( path, ':', 2 ) AS path FROM paths) AS ss;

> I could be wrong but I was thinking it would be more efficient to only
> calculate the function once.

Actually, the only thing you saved was writing out the split_part call
twice --- when the planner flattens the sub-select it expands each
reference to a sub-select output, so the split_part ends up getting
evaluated twice anyway. But the notational savings can be useful.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David Choo 2003-07-29 02:25:35 Unable to start postmaster
Previous Message Joe Conway 2003-07-28 23:17:30 Re: String manipulation