Search Postgresql Archives

Re: Run analyze on schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Suresh Raja <suresh.rajaabc@xxxxxxxxx> writes:

>     Hi All:
>    
>     Does postgresql support schema analyze.  I could not find
>     analyze schema anywhere.  Can we create a function to run
>     analyze and reindex on all objects in the schema.  Any
>     suggestions or ideas.

Yes "we" certainly can...

begin;

create function foo(sch text)
returns void as

$$
declare sql text;

begin

for sql in	
select format('analyze verbose %s.%s', schemaname, tablename) from pg_tables
where schemaname = sch

loop execute sql; end loop;

end
$$ language plpgsql;

select foo('public');
select foo('pg_catalog');


-- Enjoy!!

>    
>     Thanks,
>     -Suresh Raja
>

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@xxxxxxxxxxx
p: 312.241.7800


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux