Pessoal, com a seguinte query

SELECT
        idstat.schemaname AS schema_name,
        idstat.relname AS table_name,
        indexrelname AS index_name,
        idstat.idx_scan AS times_used,
        pg_size_pretty (pg_relation_size (idstat.relid)) AS table_size,
        pg_size_pretty (pg_relation_size (indexrelid)) 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
                AND
                idstat.schemaname = pg_indexes.schemaname
        )
        JOIN pg_stat_user_tables AS tabstat ON idstat.relid = tabstat.relid
 WHERE
 idstat.idx_scan>0 AND(indexrelname like '%pgc%')
ORDER BY 4 desc;

tive alguns resultados "estranhos"

Tabela  ìndice     Times used    Tam Tab   Tam Índ     ... Linhas
xxx     ixxx      1095393        928 kB      488 kB   ... 21316
yyy     iyyy       561467        192 kB      112 kB   ...  4308
zzz     izzz       545345         32 kB       16 kB   ...   272
www     iwww        55844       0 bytes  8192 bytes   ...     0
...

Pensei que esses índices não "deveriam" ser usados, pois o Seq Scan seria
escolhido pelo tamanho da tabela (pequena).
Esses índices foram criados de acordo com os 'index missing" do PGCluu,
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a