Re: SELECT * FROM <table> LIMIT 1; is really slow

From: pgsql(at)mohawksoft(dot)com
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David Blasby" <dblasby(at)refractions(dot)net>, "Gaetano Mendola" <mendola(at)bigfoot(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SELECT * FROM <table> LIMIT 1; is really slow
Date: 2004-05-26 23:26:20
Message-ID: 16448.24.91.171.78.1085613980.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> David Blasby <dblasby(at)refractions(dot)net> writes:
>> I just did another vacuum analyse on the table:
>
> Ah, here we go:
>
>> INFO: "csn_edges": found 0 removable, 16289929 nonremovable row
>> versions in 2783986 pages
>
> That works out to just under 6 rows per 8K page, which wouldn't be too
> bad if the rows are 1K wide on average, but are they? (You might want
> to run contrib/pgstattuple to get some exact information about average
> tuple size.)
>
>> INFO: analyzing "public.csn_edges"
>> INFO: "csn_edges": 2783986 pages, 3000 rows sampled, 6724 estimated
>> total rows
>
> This looks like a smoking gun to me. The huge underestimate of number
> of rows from ANALYZE is a known failure mode of the existing sampling
> method when the early pages of the table are thinly populated. (Manfred
> just fixed that for 7.5, btw.)

Tom, is there a way choose between a sample and full?

>
> I think you want to VACUUM FULL or CLUSTER the table, and then take a
> look at your FSM settings and routine vacuuming frequency to see if
> you need to adjust them to keep this from happening again.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2004-05-26 23:35:52 Re: Nested xacts: looking for testers and review
Previous Message pgsql 2004-05-26 23:14:12 Re: tablespaces and DB administration