Thread: scheduling of index rebuild , analyze , etc...

scheduling of index rebuild , analyze , etc...

From
Machiel Richards
Date:
Hi All

       I am fairly newbie to Postgresql and need to have the following done.

   

       ---- There have been a lot of data loads onto one of the databases and has resulted in some of the day to day queries to become very slow.

       I would like to perhaps Analyze the tables in this database as well as maybe rebuild the indexes (not sure on whether this is the right thing to do exactly)

     
       Can someone please assist me on how to do this and whether / how this can perhaps be scheduled to be done every so often.

        The database is postgresql 8.3

Regards
Machiel

Re: scheduling of index rebuild , analyze , etc...

From
"Jaime Casanova"
Date:
Machiel Richards <machielr@rdc.co.za> writes:

> Hi All
>
>        I am fairly newbie to Postgresql and need to have the following done.
>        ---- There have been a lot of data loads onto one of the
>        databases and has resulted in some of the day to day queries to
>        become very slow.
>        I would like to perhaps Analyze the tables in this database as well as maybe rebuild the indexes (not sure on
whetherthis is the right thing to do 
> exactly)
>

after a big load of data it could be usefull to ANALYZE tables... just
execute ANALYZE no need to rebuild indexes

>        Can someone please assist me on how to do this and whether / how this can perhaps be scheduled to be done
everyso often. 
>

autovacuum take cares of it normally, but if a lot of data was loaded
into several tables it can take a while until autovacuum process all of
them that's why in that case is better to execute ANALYZE manually

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL
Soporte 24x7, desarrollo, capacitación y servicios