Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Paul Lambert
Paul Lambert wrote: Just use distinct... test=# select distinct count(*),substring( href from '.*://([^/]*)' ) as domain from url group by domain order by domain; OK so distinct was redundant there... it gives the same results without it. AutoDRS=# select count(*) as occurances,substring( h

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread ogjunk-pgjedan
Ah, I figured out what to look for and found my uniq -c solution: select substring( href from '.*://([^/]*)' ) as hostname, count(substring( href from '.*://([^/]*)' )) from url where id<10 group by hostname order by count desc; hostname | count --+--

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> And what I'd like is something that would give me the counts for the > number of occurrences of each unique hostname. Something much like > `uniq -c'. Can anyone tell me how that's done or where I should look > for info? (I'm not sure what to look for, that's the problem). > select substring

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Paul Lambert
[EMAIL PROTECTED] wrote: And what I'd like is something that would give me the counts for the number of occurrences of each unique hostname. Something much like `uniq -c'. Can anyone tell me how that's done or where I should look for info? (I'm not sure what to look for, that's the problem)

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> >> I'm trying to use substr() and position() functions to extract the > >> full host name (and later a domain) from a column that holds URLs. > > > > substring( href from '.*://\([^/]*)' ); > > typo: no backslash in front of left paren substring( href from '.*://([^/]*)' ) match up thru // wi

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread ogjunk-pgjedan
Hi, Thanks, perfect! (though I'll have to look into the regex warning): => select substring( href from '.*://\([^/]*)' ) as hostname from url where id<10; WARNING: nonstandard use of escape in a string literal at character 29 HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. So n

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Paul Lambert
Andrej Ricnik-Bay wrote: Plain regex The key are the parenthesis () ... basically it will omit ANYTHING + two slashes at the beginning of a string. Then it will match everything BUT a slash, and as much of that as possible since regex are greedy by default (hence the host name he was lookin

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Andrej Ricnik-Bay
On 9/12/07, Paul Lambert <[EMAIL PROTECTED]> wrote: > > substring( href from '.*://\([^/]*)' ); > Ok, your solution looks better than mine... but I have no idea how to > interpret that, time to consult some manuals. Plain regex The key are the parenthesis () ... basically it will omit ANYTHING

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Paul Lambert
chester c young wrote: I'm trying to use substr() and position() functions to extract the full host name (and later a domain) from a column that holds URLs. substring( href from '.*://\([^/]*)' ); Ok, your solution looks better than mine... but I have no idea how to interpret that, time to

Re: [SQL] select sum within transaction problem

2007-09-11 Thread Tom Lane
"Bart Degryse" <[EMAIL PROTECTED]> writes: > I have a function like below (simplified). Everything works the way I want = > it to except for one thing. > After the select statement sum_revenues is NULL instead of the real sum. > Has this something to do with the earlier deletes and inserts not bein

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread Paul Lambert
[EMAIL PROTECTED] wrote: Hi, I'm trying to use substr() and position() functions to extract the full host name (and later a domain) from a column that holds URLs. This is what I'm trying, but it clearly doesn't do the job. => select substr(href, position('://' in href)+3, position('://' in hr

Re: [SQL] Extracting hostname from URI column

2007-09-11 Thread chester c young
> I'm trying to use substr() and position() functions to extract the > full host name (and later a domain) from a column that holds URLs. substring( href from '.*://\([^/]*)' ); Pinpoint customers who a

[SQL] Extracting hostname from URI column

2007-09-11 Thread ogjunk-pgjedan
Hi, I'm trying to use substr() and position() functions to extract the full host name (and later a domain) from a column that holds URLs. This is what I'm trying, but it clearly doesn't do the job. => select substr(href, position('://' in href)+3, position('://' in href)+3+position('/' in href)

Re: [SQL] Simple Query?

2007-09-11 Thread Richard Broersma Jr
--- Koen Bok <[EMAIL PROTECTED]> wrote: > I am doing some optimization on our search, but I need some advise... > > table: item > > idname > -- > 1 iPod > 2 Zune > 3 Walkman > > ta

Re: [SQL] Simple Query?

2007-09-11 Thread Rodrigo De León
On 9/11/07, Koen Bok <[EMAIL PROTECTED]> wrote: > Anyone has a hint? Another way: SELECT i.* FROM item i JOIN search_item s1 ON i.ID = s1.id_item JOIN search_item s2 ON s1.id_item = s2.id_item JOIN search_item s3 ON s2.id_item = s3.id_item WHERE s1.id_search = 1 AND s2.id_sear

[SQL] Simple Query?

2007-09-11 Thread Koen Bok
I am doing some optimization on our search, but I need some advise... table: item id name -- 1 iPod 2 Zune 3 Walkman table: search_item id_search id_item ---

Re: [SQL] Does postgresql8.2 supports multithreading?

2007-09-11 Thread Josh Tolley
On 9/11/07, Jyoti Seth <[EMAIL PROTECTED]> wrote: > Hi , > Does postgresql8.2 supports multithreading? > Thanks, > Jyoti Seth This depends entirely on what you mean. No, PostgreSQL isn't a multithreaded application. Yes, you can write multithreaded applications that use PostgreSQL. Consult the doc

[SQL] select sum within transaction problem

2007-09-11 Thread Bart Degryse
Dear all I have a function like below (simplified). Everything works the way I want it to except for one thing. After the select statement sum_revenues is NULL instead of the real sum. Has this something to do with the earlier deletes and inserts not being committed yet? I assumed they would have

Re: [SQL] Does postgresql8.2 supports multithreading?

2007-09-11 Thread Dave Page
A. Kretschmer wrote: > am Tue, dem 11.09.2007, um 12:38:38 +0530 mailte Jyoti Seth folgendes: >> Hi , >> >> >> >> Does postgresql8.2 supports multithreading? > > No. In the bits that (should) matter to end users (ie. libpq), yes, it does. Regards, Dave ---(end of broa

Re: [SQL] Does postgresql8.2 supports multithreading?

2007-09-11 Thread A. Kretschmer
am Tue, dem 11.09.2007, um 12:38:38 +0530 mailte Jyoti Seth folgendes: > Hi , > > > > Does postgresql8.2 supports multithreading? No. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwke

[SQL] Does postgresql8.2 supports multithreading?

2007-09-11 Thread Jyoti Seth
Hi , Does postgresql8.2 supports multithreading? Thanks, Jyoti Seth