> The index is only used for the line= part of the where clause
> with your query. With many rows the "line=" is not selective enough 
> to justify the index.

Hi,
  I tried you suggestion about 'AND counterstamp > '2001-07-26 00:00:00.0' and
it works and index is used :) But, whole query run for 10 sec (was 30s) and
it's too much, I need about 1 sec. May I optimize my tables, queries or may I
upgrade something from my HW (duron 700, 384MB RAM, slow scsi disk :( )? I
do not want solution, some hint in which part may I focus and I will go through
documentation again, thank you very much.

Best regards,
  Robert

-- 
   _
  |-|  __      Robert Vojta <vojta-at-ipex.cz>          -= Oo.oO =-
  |=| [Ll]     IPEX, s.r.o.
  "^" ====`o
Fri, 27 Jul 2001 14:57:13 +0200
Robert Vojta <vojta@ipex.cz>
Re: indexes and big tables
> The index is only used for the line= part of the where clause
> with your query. With many rows the "line=" is not selective enough 
> to justify the index.

  I tried move only needed data into new table and change query into ...

netacc=> EXPLAIN SELECT counterfrom AS from, counterto AS to,
floor((980000000 - date_part('epoch', counterstamp)) / 300) AS sequence
FROM graphs_5m WHERE line='absolonll'; NOTICE:  QUERY PLAN:
 
Index Scan using graphs_5m_idx on graphs_5m (cost=0.00..58.38 rows=29
width=24)
 
EXPLAIN

  and query runs for 3-5 seconds. Any idea how to make it faster? I think,
that now it's ready to HW upgrade for faster result ...

Best regards,
  Robert

-- 
   _
  |-|  __      Robert Vojta <vojta-at-ipex.cz>          -= Oo.oO =-
  |=| [Ll]     IPEX, s.r.o.
  "^" ====`o
Fri, 27 Jul 2001 15:02:26 +0200
Robert Vojta <vojta@ipex.cz>
Re: indexes and big tables