[SQL] Index working, but not inside function

2007-07-10 Thread Patrick Clery
## THE PROBLEM I'm trying to write a function that will select the ID of a row from a very large table (2M rows) using an index (places_autocomplete_idx). When I execute the function the query stalls and is apparently not taking advantage of the index. However, executing the same query outside

[SQL] CIdr query qestion

2007-07-10 Thread Michele Petrazzo - Unipex srl
Hi ml! A question about cidr query. I'm tring to use the various cidr functions to exclude a A sub class, but I don't understand how use it: SELECT count(ip_addr), ip_addr from wi_log_network where ip_addr != network('10.10.0.0/16', 16) group by (ip_addr); it don't exclude the 10.10 ! Tried

Re: [SQL] CIdr query qestion

2007-07-10 Thread Jesper K. Pedersen
On Tue, 10 Jul 2007 09:36:49 +0200 Michele Petrazzo - Unipex srl [EMAIL PROTECTED] wrote: Hi ml! A question about cidr query. I'm tring to use the various cidr functions to exclude a A sub class, but I don't understand how use it: SELECT count(ip_addr), ip_addr from wi_log_network where

Re: [SQL] CIdr query qestion

2007-07-10 Thread Michael Fuhr
On Tue, Jul 10, 2007 at 09:36:49AM +0200, Michele Petrazzo - Unipex srl wrote: A question about cidr query. I'm tring to use the various cidr functions to exclude a A sub class, but I don't understand how use it: SELECT count(ip_addr), ip_addr from wi_log_network where ip_addr !=

[SQL] Database system identifier from SQL

2007-07-10 Thread Peter Eisentraut
Is there a way to query the database system identifier that pg_controldata outputs from SQL? -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: Is there a way to query the database system identifier that pg_controldata outputs from SQL? Don't think so. Do you have a use-case for providing a function to return that? regards, tom lane ---(end

Re: [SQL] Index working, but not inside function

2007-07-10 Thread Tom Lane
Patrick Clery [EMAIL PROTECTED] writes: When I execute the function the query stalls and is apparently not taking advantage of the index. Your example doesn't demonstrate any such thing; what seems more likely is that there are a whole lot of rows matching 'United States' and so the query

Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Peter Eisentraut
Tom Lane wrote: Peter Eisentraut [EMAIL PROTECTED] writes: Is there a way to query the database system identifier that pg_controldata outputs from SQL? Don't think so. Do you have a use-case for providing a function to return that? I'd like to find out whether two connections are really

Re: [SQL] Database system identifier from SQL

2007-07-10 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: Tom Lane wrote: Peter Eisentraut [EMAIL PROTECTED] writes: Is there a way to query the database system identifier that pg_controldata outputs from SQL? Don't think so. Do you have a use-case for providing a function to return that? I'd like to