Unix Technical Forum

Re: two queries and dual cpu (perplexed)

This is a discussion on Re: two queries and dual cpu (perplexed) within the Pgsql Performance forums, part of the PostgreSQL category; --> Shoaib Burq (VPAC) wrote: > OK ... so just to clearify... (and pardon my ignorance): > > I need ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 11:38 AM
John A Meinel
 
Posts: n/a
Default Re: two queries and dual cpu (perplexed)

Shoaib Burq (VPAC) wrote:
> OK ... so just to clearify... (and pardon my ignorance):
>
> I need to increase the value of 'default_statistics_target' variable and
> then run VACUUM ANALYZE, right? If so what should I choose for the
> 'default_statistics_target'?
>
> BTW I only don't do any sub-selection on the View.
>
> I have attached the view in question and the output of:
> SELECT oid , relname, relpages, reltuples
> FROM pg_class ORDER BY relpages DESC;
>
> reg
> shoaib


Actually, you only need to alter the statistics for that particular
column, not for all columns in the db.

What you want to do is:

ALTER TABLE "ClimateChangeModel40"
ALTER COLUMN <whatever the column is>
SET STATISTICS 100;
VACUUM ANALYZE "ClimateChangeModel40";

The column is just the column that you have the "IX_ClimateId" index on,
I don't know which one that is.

The statistics value ranges from 1 - 1000, the default being 10, and for
indexed columns you are likely to want somewhere between 100-200.

If you set it to 100 and the planner is still mis-estimating the number
of rows, try 200, etc.

The reason to keep the number low is because with a high number the
planner has to spend more time planning. But especially for queries like
this one, you'd rather the query planner spent a little bit more time
planning, and got the right plan.

John
=:->


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFCbli2JdeBCYSNAAMRAiXeAKCVM0Ztv+uS4M3QVpvOlA mLNDUG1gCgqXO4
NDf1CoRgLcG6zRcfGonU844=
=q+fT
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:14 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com