Re: Tuning random_page_cost

From: "Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de>
To: "Bruno Wolff III" <bruno(at)wolff(dot)to>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Tuning random_page_cost
Date: 2004-07-13 12:57:50
Message-ID: 2266D0630E43BB4290742247C891057505AFCCDA@dozer.computec.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks, that seems to have done the trick :)

> -----Ursprüngliche Nachricht-----
> Von: Bruno Wolff III [mailto:bruno(at)wolff(dot)to]
> Gesendet: Dienstag, 13. Juli 2004 14:44
> An: Markus Wollny
> Cc: pgsql-general(at)postgresql(dot)org
> Betreff: Re: [GENERAL] Tuning random_page_cost
>
> On Tue, Jul 13, 2004 at 13:30:29 +0200,
> Markus Wollny <Markus(dot)Wollny(at)computec(dot)de> wrote:
> > Hi!
> >
> > I've got a query that has a where clause on a timestamp field:
> >
> > select t.board_id
> > , t.thread_id
> > from public.board_thread t
> > where t.last_reply <= now()-'6 months'::interval
> > limit 1
> >
> > I've got random_page_cost set to 1.4 which is fine for most
> queries;
> > yet here the planner prefers a (slower) sequential scan:
>
> If you know that an index scan is better you can fudge the
> query to change the planner's estimate of the number of rows
> that will be returned.
> The normal fudge is to add a >= check for some timestamp that
> is earlier than any in the column, so that you will have a
> range condition, but not any change in the rows returned.
>

Browse pgsql-general by date

  From Date Subject
Next Message Florian G. Pflug 2004-07-13 13:11:25 Re: (Again) Datacorruption using 7.4.2 on XFS/raid1
Previous Message Bruno Wolff III 2004-07-13 12:43:54 Re: Tuning random_page_cost