Tables used in query not listed in EXPLAIN

Поиск
Список
Период
Сортировка
От Alvaro Melo
Тема Tables used in query not listed in EXPLAIN
Дата
Msg-id 544021F6.9040801@atua.com.br
обсуждение исходный текст
Ответы Re: Tables used in query not listed in EXPLAIN  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

I have a peculiar situation here. I'm optimizing some queries and I
noticed that EXPLAIN doesn't always show the tables involved in the
query. Below is a little example, but I have other examples with longer
queries. Note that the tables tabela_documento_fiscal and pessoa aren't
considered on it's output. Am I missing someting or it might be a bug?

Details:
PostgreSQL 9.2.6 on x86_64-unknown-linux-gnu, compiled by gcc (Debian
4.7.2-5) 4.7.2, 64-bit
Debian GNU/Linux 7.3 (wheezy)


vidal=> EXPLAIN
vidal-> SELECT COUNT(*)
vidal-> FROM documento_eletronico de
vidal-> ;
                                      QUERY PLAN
------------------------------------------------------------------------------------
  Aggregate  (cost=4856.12..4856.14 rows=1 width=0)
    ->  Seq Scan on documento_eletronico de  (cost=0.00..4606.50
rows=99850 width=0)

vidal=> EXPLAIN
vidal-> SELECT COUNT(*)
vidal-> FROM documento_eletronico de
vidal->      LEFT OUTER JOIN tabela_documento_fiscal tdf ON
tdf.cd_documento = de.cd_documento
vidal-> ;
                                      QUERY PLAN
------------------------------------------------------------------------------------
  Aggregate  (cost=4856.12..4856.14 rows=1 width=4)
    ->  Seq Scan on documento_eletronico de  (cost=0.00..4606.50
rows=99850 width=4)
(2 rows)

vidal=> EXPLAIN SELECT COUNT(*)
FROM documento_eletronico de
      LEFT OUTER JOIN tabela_documento_fiscal tdf ON tdf.cd_documento =
de.cd_documento
      LEFT OUTER JOIN pessoa                   pc ON     pc.cd_pessoa =
de.cd_pessoa_usuario
;
                                      QUERY PLAN
------------------------------------------------------------------------------------
  Aggregate  (cost=4856.12..4856.14 rows=1 width=8)
    ->  Seq Scan on documento_eletronico de  (cost=0.00..4606.50
rows=99850 width=8)
(2 rows)

vidal=> EXPLAIN
vidal-> SELECT * FROM pessoa;
                            QUERY PLAN
----------------------------------------------------------------
  Seq Scan on pessoa  (cost=0.00..3102.07 rows=133007 width=117)



--
Álvaro Nunes Melo    Atua Sistemas de Informação
alvaro@atua.com.br   http://www.atua.com.br
(54) 9976-0106       (54) 3045-4144



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Newb question - PostgreSQL ODBC Driver for Teiid
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Tables used in query not listed in EXPLAIN