Re: EXPLAIN ANALYZE in batch file

Поиск
Список
Период
Сортировка
От Willy-Bas Loos
Тема Re: EXPLAIN ANALYZE in batch file
Дата
Msg-id CAHnozTi7nL2UBaCU9GuYiCzQrmnAejnUo+Trx6ApFzNXJwDqBg@mail.gmail.com
обсуждение исходный текст
Ответ на EXPLAIN ANALYZE in batch file  (michel wildcat <m.wildcat82@gmail.com>)
Список pgsql-novice
just make a text file with the sql commands in it.
end each command with a ;
the make a scheduled job that executes the program psql, taking the commands from the file.

so, i make text file calles test.sql. the contents are:
vacuum analyze;
create table test as select 'hello world'::text;
--the end

then make a scheduled job that executes this command:
psql -f test.sql -U itsme postgres
(psql is the command line client for postgresql, manual here: http://www.postgresql.org/docs/9.1/static/app-psql.html)

It would ask for a password, so you need to create a way to allow the script to run without you typing the password.
i use peer authentication, but that is not supported in windows.
you could use the password file for that:
On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile).
It should look like this:
hostname:port:database:username:password

so for example:
localhost:5432:postgres:itsme:secret

HTH

WBL

On Sat, May 19, 2012 at 11:02 AM, michel wildcat <m.wildcat82@gmail.com> wrote:
hello,
I am working with PostgreSQL 9 in windows (pgAdmin3) and I'm trying to
execute EXPLAIN ANALYZE command on some queries that are
really time consumming. I would like to do it at once  and send the
results to a single file.
can anybody help me to solve this please?
thanks

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



--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth

В списке pgsql-novice по дате отправления:

Предыдущее
От: michel wildcat
Дата:
Сообщение: Fwd: sequential explain analyze command execution
Следующее
От: Willy-Bas Loos
Дата:
Сообщение: Re: PG_DUMP producing incorrect SQL