Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Giorgio Valoti
On 07/ago/08, at 23:01, Tom Lane wrote: Giorgio Valoti <[EMAIL PROTECTED]> writes: On 07/ago/08, at 17:50, Tom Lane wrote: These numbers seem pretty bogus: there is hardly any scenario in which a full-table indexscan should be costed as significantly cheaper than a seqscan. Have you put i

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Tom Lane
Giorgio Valoti <[EMAIL PROTECTED]> writes: > On 07/ago/08, at 17:50, Tom Lane wrote: >> These numbers seem pretty bogus: there is hardly any scenario in >> which a >> full-table indexscan should be costed as significantly cheaper than a >> seqscan. Have you put in silly values for random_page_co

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Giorgio Valoti
On 07/ago/08, at 20:37, Giorgio Valoti wrote: […] If you haven't mucked with the cost parameters, the only way I can think of to get this result is to have an enormously bloated table that's mostly empty. Maybe you need to review your vacuuming procedures. I’ll review them. I’ve ma

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Giorgio Valoti
On 07/ago/08, at 14:36, Richard Huxton wrote: Giorgio Valoti wrote: On 07/ago/08, at 10:35, Richard Huxton wrote: Giorgio Valoti wrote: Hi, I have a timestamptz field that I want to use with a query, but I don’t need the full timestamp resolution, so I’ve created a day_trunc(timestamptz)

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Giorgio Valoti
On 07/ago/08, at 17:50, Tom Lane wrote: Giorgio Valoti <[EMAIL PROTECTED]> writes: GroupAggregate (cost=98431.58..119773.92 rows=74226 width=8) -> Sort (cost=98431.58..99050.92 rows=247736 width=8) Sort Key: (day_trunc(ts)) -> Seq Scan on blackbox (cost=0.00..72848.3

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Tom Lane
Giorgio Valoti <[EMAIL PROTECTED]> writes: > GroupAggregate (cost=98431.58..119773.92 rows=74226 width=8) > -> Sort (cost=98431.58..99050.92 rows=247736 width=8) > Sort Key: (day_trunc(ts)) > -> Seq Scan on blackbox (cost=0.00..72848.36 rows=247736 width=8) > Group

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Richard Huxton
Giorgio Valoti wrote: On 07/ago/08, at 10:35, Richard Huxton wrote: Giorgio Valoti wrote: Hi, I have a timestamptz field that I want to use with a query, but I don’t need the full timestamp resolution, so I’ve created a day_trunc(timestamptz) immutable function which I’ll use with the query

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Giorgio Valoti
On 07/ago/08, at 10:35, Richard Huxton wrote: Giorgio Valoti wrote: Hi, I have a timestamptz field that I want to use with a query, but I don’t need the full timestamp resolution, so I’ve created a day_trunc(timestamptz) immutable function which I’ll use with the query and with a new inde

Re: [PERFORM] Query Plan choice with timestamps

2008-08-07 Thread Richard Huxton
Giorgio Valoti wrote: Hi, I have a timestamptz field that I want to use with a query, but I don’t need the full timestamp resolution, so I’ve created a day_trunc(timestamptz) immutable function which I’ll use with the query and with a new index: logs=> create index test_idx on blackbox (day_t