Probando el módulo Index Adviser

From: Yessica Brinkmann <yessica(dot)brinkmann(at)gmail(dot)com>
To: pgsql-es-ayuda <pgsql-es-ayuda(at)lists(dot)postgresql(dot)org>
Subject: Probando el módulo Index Adviser
Date: 2018-08-31 02:25:42
Message-ID: CABrYqSOzeMHWT4scb6KKi0NwH6QK--13ZNct43+EJUxFC2HuNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Buenas,
No sé si recordarán que en mi mail anterior había indicado que había podido
realizar las pruebas correspondientes del módulo del Index Adviser.
Bueno, resulta ser que había hecho las pruebas interactivas, manuales, con
psql. Y esto pude hacer todo. Y me funcionó todo correctamente.
Mi problema es ahora al realizar las pruebas con la herramienta, con un
archivo de carga de trabajo sql. No me había dado cuenta de que esta forma
de usar también existía, pero luego leí de nuevo el README y me di cuenta
de que también estaba allí. No sé hasta dónde esta pregunta también tenga
que ver ya con el Postgresql, ya que talvez ya es específico de la
herramienta. Pero hago la pregunta por si alguno de ustedes tenga una idea
de cómo ejecutar esta herramienta.

Lo que dice el README en cuanto a esta herramienta es lo siguiente:

pg_advise_index tool.
---------------------

Create a file that contains all the queries (semicolon terminated;
may
be multi-line) that are expected to be executed by the application; and
feed this file to the pg_advise_index tool with appropriate options.

pg_advise_index -d DB -h host -U user -s 10M -o advisory.sql
workload.sql

pg_advise_index will open a connection with the PostgreSQL server by
setting appropriate session level options that will force the backend to
load
the pg_index_adviser plugin. It will then prepend the keywords EXPLAIN to
each
of the queries found in the workload file, and execute them against the
backend.
For each query EXPLAINed, the backend will generate advice for each index
that
might have been beneficial in executing these queries.

At the end, pg_advise_index will enumerate all the indexes
suggested for
the current session, and output the CREATE INDEX statements for each of
them.
Optinally, if the -size option was specified, pg_advise_index will output
suggestions
for only those indexes, that fit into that size.

En teoría esa es la forma de usar.
Y en una de las carpetas del módulo encontré un ejemplo de sesión del
advise index.
Y esto es lo que se encuentra en dicho archivo:

$ cat workload.sql
select * from t where a = 100;
select * from t where b = 100;
select * from t where a = 100 and b = 100;
select * from t where a = 100 or b = 100;
select * from t1 where a = 100;
select * from t1 where b = 100;
select * from t1 where a = 100 and b = 100;
select * from t1 where a = 100 or b = 100;
select * from t, t1 where t.a = 100 and t1.a = 100 or t.b = 100 and t1.b =
100;

$ db/bin/pg_advise_index.exe -d postgres -h localhost -p 5432 -U test -o
create_index.sql workload.sql
load workload from file 'workload.sql'
Analyzing queries ......... done.
size = 2608 KB, benefit = 184483000.000000
size = 2608 KB, benefit = 184481000.000000
/* 1. t(b): size=2608 KB, benefit=184483000.00 */
/* 2. t(a): size=2608 KB, benefit=184481000.00 */
/* Total size = 5216KB */

$ cat create_index.sql
create index idx_t_1 on t (b);
create index idx_t_2 on t (a);

Yo tengo ya el archivo workload.sql. Ya lo escribí. Lo que no puedo
encontrar en ninguna parte es esta herramienta pg_advise_index o
pg_advise_index.exe a la que hace referencia la explicación del readme y el
ejemplo. Ejecuté el comando find pero no la encuentro en ninguna parte. Por
más que ya está instalado el Index Adviser correctamente. Por las dudas,
también traté de correr la herramienta desde psql, haciendo previamente
load del index_adviser, pero tampoco funciona. Me dice que hay un error de
sintaxis cerca de pg_advise_index, error near pg_advise_index. Aunque no
creo que esa sea la manera correcta de ejecutar, por si acaso probé nomás
también.
Alguien tiene alguna idea de adonde puedo encontrar esa herramienta
pg_advise_index o pg_advise_index.exe para ejecutar?
Agradeceré mucho una respuesta.
Saludos cordiales,
Yessica

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Yessica Brinkmann 2018-09-09 17:38:26 Re: Probando el módulo Index Adviser
Previous Message Jaime Soler 2018-08-30 08:18:02 Re: Seleccionar columnas por su posicion en lugar de su nombre