Re: [GENERAL] Index usage with slow query

2014-07-25 Thread Marc Mamin
>The presence of absence of the length limiter on a varchar will not impact >the query plan. And I'm pretty sure you cannot even store a too long >varchar in an index. It will error on the attempt (as opposed to >truncating). The max size is almost one block. After that you get an error: FEHL

Re: [GENERAL] Index usage with slow query

2014-07-25 Thread David G Johnston
Bill Moran wrote > On Fri, 25 Jul 2014 17:20:57 +0100 > Rebecca Clarke < > r.clarke83@ > > wrote: > > Note that this is speculation on my part, but the > point being that if those columns are usually as narrow as your > examples you might want to try changing them to VARCHAR(50) or > something a

Re: [GENERAL] Index usage with slow query

2014-07-25 Thread Bill Moran
On Fri, 25 Jul 2014 17:20:57 +0100 Rebecca Clarke wrote: > Hi Bill, > > Thanks for the reply. Here's the EXPLAIN output of a couple of the queries: A few suggestions in addition to David's comment about doing EXPLAIN ANALYZE: 1) When experimenting, one thing to try might be making a single G

Re: [GENERAL] Index usage with slow query

2014-07-25 Thread David G Johnston
Rebecca Clarke-2 wrote > Thanks for the reply. Here's the EXPLAIN output of a couple of the > queries: Typically you want to provide EXPLAIN ANALYZE output so that comparisons between planner estimates and reality can be made. David J. -- View this message in context: http://postgresql.1045

Re: [GENERAL] Index usage with slow query

2014-07-25 Thread Rebecca Clarke
Hi Bill, Thanks for the reply. Here's the EXPLAIN output of a couple of the queries: SELECT the_geom,oid from mytable where the_geom && ST_GeomFromText('POLYGON((529342.334095833 180696.22173,529342.334095833 181533.44595,530964.336820833 181533.44595,530964.336820833 180696.22173,529342

Re: [GENERAL] Index usage with slow query

2014-07-23 Thread Bill Moran
On Wed, 23 Jul 2014 10:45:56 +0100 Rebecca Clarke wrote: > Hi all, > > Looking for some advice regarding a slow query I have and indexing. > > I'm using postgresql 9.1 and this is my table that has around 680 rows: > > CREATE TABLE mytable > ( > class character varying, > floor charact

[GENERAL] Index usage with slow query

2014-07-23 Thread Rebecca Clarke
Hi all, Looking for some advice regarding a slow query I have and indexing. I'm using postgresql 9.1 and this is my table that has around 680 rows: CREATE TABLE mytable ( class character varying, floor character varying, source_id integer, the_geom geometry ) WITH ( OIDS=TRUE );