agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Jerry Sievers <gsievers19@comcast.net>
To: Suresh Raja <suresh.rajaabc@gmail.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Run analyze on schema
Date: Mon, 22 Jun 2015 18:53:59 -0500
Message-ID: <86ioaf1eqw.fsf@jerry.enova.com> (raw)
In-Reply-To: <CAJP7dtDi4PDGOoxoAMDkr7bAz928mPvC21beNeCL9baAF11mRQ@mail.gmail.com>
References: <CAJP7dtDi4PDGOoxoAMDkr7bAz928mPvC21beNeCL9baAF11mRQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Suresh Raja <suresh.rajaabc@gmail.com> 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@comcast.net
p: 312.241.7800
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
view thread (3+ messages) latest in thread
Message-ID: <86ioaf1eqw.fsf@jerry.enova.com>
Permalink: ../86ioaf1eqw.fsf@jerry.enova.com/
Also on: postgresql.org/message-id/86ioaf1eqw.fsf@jerry.enova.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gsievers19@comcast.net, suresh.rajaabc@gmail.com, pgsql-general@postgresql.org
Subject: Re: Run analyze on schema
In-Reply-To: <86ioaf1eqw.fsf@jerry.enova.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox