Re: table full scan or index full scan?

From: peixubin <peixubin(at)yahoo(dot)com(dot)cn>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table full scan or index full scan?
Date: 2009-10-12 09:25:39
Message-ID: 174331.9796.qm@web15007.mail.cnb.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I understood , thanks.
--- 09年10月12日,周一, Martijn van Oosterhout <kleptog(at)svana(dot)org> 写道:

发件人: Martijn van Oosterhout <kleptog(at)svana(dot)org>
主题: Re: [GENERAL] table full scan or index full scan?
收件人: "Peter Hunsberger" <peter(dot)hunsberger(at)gmail(dot)com>
抄送: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "???? ??" <peixubin(at)yahoo(dot)com(dot)cn>, pgsql-general(at)postgresql(dot)org
日期: 2009年10月12日,周一,下午2:25

On Sun, Oct 11, 2009 at 10:01:52PM -0500, Peter Hunsberger wrote:
> This is interesting, I just ran a similar issue the other day.
> Clearly there is a wide range of read / write scenarios that Postgres
> should be able to cover.  These days, I have a lot of designs leaning
> more toward the data warehouse side of the operational spectrum as
> opposed to the high transaction scenario and I specifically design DB
> management strategies with the knowledge that writes will happen far
> less than reads in our applications.  Is this an area where
> optimizations are considered hard in Postrgres or hopefully, just
> something that is on the todo list but just no one has gotten around
> to yet? 

We consider any optimisation that is feasible. Unfortunatly, "the
number of rows in a table" is a fairly hard number to get in the
general case because it depends on who is asking (different
transactions may get different answers).

>Similarly, are accurate table summary stats possible someday
> or are they considered close to impossible in order to eliminate race
> conditions and lock contention scenarios?

It is possible, it's just not cheap in the general case. The usual
approach is to keep a table that tracks the number of rows. By using
deltas you can make it lockfree. These are however costs most
applications do't need. If you know in your case that the data never
changes, just cache the result somewhere. That will be infinitly more
efficient than any other method.

If you are happy with estimates, they are there and are kept reasonably
uptodate.

Have a nice day,
--
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

___________________________________________________________
好玩贺卡等你发,邮箱贺卡全新上线!
http://card.mail.cn.yahoo.com/

Browse pgsql-general by date

  From Date Subject
Next Message Vasiliy G Tolstov 2009-10-12 11:17:42 auth problem
Previous Message Martijn van Oosterhout 2009-10-12 08:31:56 Re: Window function order changing order of whole query