Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Consulta sobre índices

From: Juan <smalltalker(dot)marcelo(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Marcos Luis Ortiz Valmaseda <marcosluis2186(at)googlemail(dot)com>, ๏̯͡๏ Guido Barosio <gbarosio(at)gmail(dot)com>, Ana Smail <anasmail(at)unnoba(dot)edu(dot)ar>, pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Consulta sobre índices
Date: 2010-08-30 16:45:43
Message-ID: AANLkTinG7d9KVHUTYK1dywMxNf+7tsUeoH0wS+ge5Hxk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Alvaro

Siguio sin andar pero siguiendo tu indicacion tambien castee la otra
expresion y anduvo :D

indexrelname::regclass

quedo asi ( y anda, no da error. )
SELECT idstat.relname AS table_name,
indexrelname AS index_name,
idstat.idx_scan AS times_used,
pg_size_pretty(pg_relation_size(idstat.relname::regclass )) AS
table_size, pg_size_pretty(pg_relation_size(indexrelname::regclass))
AS index_size,
n_tup_upd + n_tup_ins + n_tup_del as num_writes,
indexdef AS definition
FROM pg_stat_user_indexes AS idstat JOIN pg_indexes ON indexrelname = indexname
JOIN pg_stat_user_tables AS tabstat ON idstat.relname = tabstat.relname
WHERE idstat.idx_scan < 200
AND indexdef !~* 'unique'
ORDER BY idstat.relname, indexrelname;

salu2
mdc

2010/8/30 Alvaro Herrera <alvherre(at)commandprompt(dot)com>:
> Excerpts from Juan's message of lun ago 30 12:35:37 -0400 2010:
>
>> ERROR:  no existe la función pg_relation_size(name)
>> LINE 4: pg_size_pretty(pg_relation_size(idstat.relname)) AS table_si...
>>                        ^
>> HINT:  Ninguna función coincide en el nombre y tipos de argumentos.
>> Puede desear agregar conversión explícita de tipos.
>>
>> select version() me devuelbve esto en mi pgadmin
>>
>> "PostgreSQL 8.4.4, compiled by Visual C++ build 1400, 32-bit"
>>
>> SERA QUE ESA QUERY ES PARA UNA VERSON MAS VIEJA?
>
> vaya, que raro.  Agrega un cast a regclass:
>
> ... pg_size_pretty(pg_relation_size(idstat.relname::regclass)) AS ...
>
> Creo que el Wiki necesita una correccion.
>
> --
> Álvaro Herrera <alvherre(at)commandprompt(dot)com>
> The PostgreSQL Company - Command Prompt, Inc.
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Carlos Bazán 2010-08-30 17:12:59 Re: Consulta sobre índices
Previous Message Alvaro Herrera 2010-08-30 16:41:42 Re: Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] Consulta sobre índices