Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

424
Visualizações
ANALYZE command on index returns warning in PostgreSQL

After reading through documentation I found that Analyze is to collect information about the given table which will be used by the planner at a later point to plan the execution of a query. In Oracle, there is an option to analyze the indexes. In the case of PostgreSQL, ANALYZE command returns warning for the index. I think index should be equally important to PostgreSQL so why it is not supported in PostgreSQL. I might have missed something, Can someone point to the right documentation with which I can get more understanding about this?

postgres=# Create table test(empno integer);
CREATE TABLE
postgres=# create index idx_test1 on test(empno );
CREATE INDEX
postgres=# \di idx_test1
                 List of relations
 Schema |   Name    | Type  |  Owner  | Table 
--------+-----------+-------+---------+-------
 public | idx_test1 | index |   Xyz   | test
(1 row)

postgres=# analyze public.idx_test1
postgres-# ;
2020-06-29 16:37:30.665 IST [118434] WARNING:  skipping "idx_test1" --- cannot analyze non-tables or special system tables
WARNING:  skipping "idx_test1" --- cannot analyze non-tables or special system tables
ANALYZE
postgres=# 
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

ANALYZE collects statistics about the data in the table (e.g number of distinct values, highest value, lowest value and so on).

Quote from the manual

The statistics collected by ANALYZE usually include a list of some of the most common values in each column and a histogram showing the approximate data distribution in each column.

An index essentially stores a copy of the data stored in the table (but in an ordered fashion, suitable for a quick lookup).

Analyzing the index would thus not yield any additional information compared to analyzing the table. The only exception would be expression based indexes (as the expressions value is not directly stored in the table), for which this might make sense. However that isn't implemented as far as I know

over 4 years ago · Santiago Trujillo Relatório

0

ANALYZE will accept any object that is stored in the pg_class system catalog, that is (partitioned or non-partitioned) tables, (partitioned or non-partitioned) indexes, foreign tables, sequences, TOAST tables, views and materialized views.

However, it will only process partitioned or non-partitioned tables and materialized views. These are the only objects for which it makes sense to collect statistics. For all other object types you will get a warning similar to the one you get, and the object will be skipped.

To collect statistics for an indexed column or expression, ANALYZE the table on which the index is defined.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda