From: | "David Olbersen" <DOlbersen(at)stbernard(dot)com> |
---|---|
To: | "pgsql-novice" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: String manipulation |
Date: | 2003-07-28 23:08:42 |
Message-ID: | E7E213858379814A9AE48CA6754F5ECB0D7022@mail01.stbernard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Joe,
> SELECT substring(path from position(' ' in path) + 1)
> FROM (SELECT split_part( path, ':', 2 ) AS path FROM paths) AS ss;
That's cool enough except for the sub-select which would really slow down the query on a million+ row table. My solution is just reformatting data and doesn't add much if any over head to "SELECT path FROM paths".
...but that's all speculation, am I right? I'd like to revise my thinking if I'm wrong.
--------------------------
David Olbersen
iGuard Engineer
St. Bernard Software
11415 West Bernardo Court
San Diego, CA 92127
1-858-676-2277 x2152
> -----Original Message-----
> From: Joe Conway [mailto:mail(at)joeconway(dot)com]
> Sent: Monday, July 28, 2003 3:55 PM
> To: David Olbersen
> Cc: pgsql-novice
> Subject: Re: [NOVICE] String manipulation
>
>
> David Olbersen wrote:
> > I have an *UGLY* solution that might give you or others
> some ideas...
> >
> > SELECT
> > substring(
> > split_part( path, ':', 2 )
> > from
> > position( ' ' in split_part( path, ':', 2 ) ) + 1
> > )
> > FROM paths;
> >
>
> That solution was pretty much what I was thinking. An alternative:
>
> SELECT substring(path from position(' ' in path) + 1)
> FROM (SELECT split_part( path, ':', 2 ) AS path FROM paths) AS ss;
>
> Joe
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2003-07-28 23:17:30 | Re: String manipulation |
Previous Message | Joe Conway | 2003-07-28 22:55:08 | Re: String manipulation |