Re: [HACKERS] indexes and big tables

2001-07-28 Thread Robert Vojta
> Is there any possibility of overlapping rows between the parts of the > union? If not, I'd suggest union all, since that might get rid of the top > level unique and sort steps (probably not a huge gain, but might help). Hi, thanx for the response, there is a little possibility of overlapping

Re: [HACKERS] indexes and big tables

2001-07-27 Thread Stephan Szabo
On Fri, 27 Jul 2001, Robert Vojta wrote: > netacc=> EXPLAIN (SELECT SUM(counterfrom) AS from, SUM(counterto) AS to, > floor((985098900 - date_part('epoch', counterstamp)) / 300) AS sequence > FROM counters WHERE line='absolonll' AND date_part('epoch', counterstamp) > > 984978900 GROUP BY sequence

Re: [HACKERS] indexes and big tables

2001-07-27 Thread Robert Vojta
> 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, fl

Re: [HACKERS] indexes and big tables

2001-07-27 Thread Robert Vojta
> 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

Re: [HACKERS] indexes and big tables

2001-07-27 Thread Robert Vojta
> I would guess the problem is the restriction on counterstamp, because > written like that, it probably can't use the index. > > try something where you avoid the use of the date_part function e.g.: > AND counterstamp > '2001-07-26 00:00:00.0' I will try it, but it use the index when t

AW: [HACKERS] indexes and big tables

2001-07-27 Thread Zeugswetter Andreas SB
> netacc=> EXPLAIN (SELECT SUM(counterfrom) AS from, > SUM(counterto) AS to, > floor((985098900 - date_part('epoch', counterstamp)) / 300) > AS sequence > FROM counters WHERE line='absolonll' AND date_part('epoch', > ) counterstamp > 984978900 GROUP BY sequence, line) ... I would guess the pr

[HACKERS] indexes and big tables

2001-07-27 Thread Robert Vojta
Hi, I'm fighting with problem with indexes. I read documentation about performance tips, about internal logic functions which are making decision if to use or not use indexes, etc. and I'm still failed. I'm not SQL guru and I don't know what to do now. My tables and indexes looks like ... CREAT