Re: [GENERAL] Slow query and indexes...

2007-05-07 Thread Jonas Henriksen
ndrew Kroeger <[EMAIL PROTECTED]> wrote: Jonas Henriksen wrote: >>> explain analyze SELECT max(date_time) FROM data_values; > Goes fast and returns: In prior postgres versions, the planner could not take advantage of indexes with max() (nor min()) calculations. A workaroun

Re: [GENERAL] Slow query and indexes...

2007-05-07 Thread Jonas Henriksen
eeds up the query and forces the use of the index, but I dont really love that solution... regards Jonas:)) On 5/7/07, Peter Eisentraut <[EMAIL PROTECTED]> wrote: Am Montag, 7. Mai 2007 15:53 schrieb Jonas Henriksen: > while if I add a GROUP BY data_logger the query uses a seq scan a

[GENERAL] Slow query and indexes...

2007-05-07 Thread Jonas Henriksen
Hi, I'm trying to figure out how to make postgres utilize my indexes on a table. this query: explain analyze SELECT max(date_time) FROM data_values; Goes fast and returns: QUERY PLAN ---

Re: [GENERAL] strange query filter problems

2006-04-20 Thread Jonas Henriksen
Thanks, increasing the statistics did the trick: ALTER TABLE tskjema ALTER species SET STATISTICS 999 Is there a rule of thumb to tell how to set the statistics? Jonas:)) On 4/19/06, Martijn van Oosterhout wrote: > On Wed, Apr 19, 2006 at 01:53:46PM +0200, Jonas Henriksen wrote: >

Re: [GENERAL] strange query filter problems

2006-04-19 Thread Jonas Henriksen
L'::bpchar) AND (species ~<~ 'TAGGMAKRELM'::bpchar))" "Filter: (species ~~ 'TAGGMAKRELL%'::text)" " -> Index Scan using dateix on sskjema s (cost=0.00..4025.13 rows=1443 width=157) (actual time=0.026..76.451 rows=14340 loops=1703)" &qu

[GENERAL] strange query filter problems

2006-04-19 Thread Jonas Henriksen
Hi, I have a problem with a slow query. (I have run vacuum full analyze!) It seems that the query below works OK because the query planner filters on the date first. It takes about 0.3 sec: EXPLAIN SELECT * FROM sskjema s INNER JOIN tskjema t USING(sskjema_pkey) WHERE t.species::char(12) LIKE 'TAGG