Re: [PERFORM] Index usage with functions in where condition

2010-07-09 Thread Jeremy Palmer
eremy Palmer Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Index usage with functions in where condition Jeremy Palmer writes: > This is the query that does not use the indexes: > SELECT > coo.nod_id, > 640*radians(sqrt((coo.value1 - -41.0618)^2+((coo.value2 -

Re: [PERFORM] Index usage with functions in where condition

2010-07-09 Thread Tom Lane
Jeremy Palmer writes: > This is the query that does not use the indexes: > SELECT > coo.nod_id, > 640*radians(sqrt((coo.value1 - -41.0618)^2+((coo.value2 - > 175.58461)*cos(radians(-41.0618)))^2)) as distance > FROM > crs_coordinate coo > WHERE > coo.value1 between -41.0618-degrees(

[PERFORM] Index usage with functions in where condition

2010-07-09 Thread Jeremy Palmer
I'm having trouble getting the query planner to use indexes. The situation occurs when writing a query that uses functions for defining the parameters for the conditions on the indexed columns. The system I'm running is Windows Server 2003, using version 8.4.2 of PostgreSQL. This is the followi