Criou um índice para este campo?

Marcos André G.A
Trabin Softwarre & Consulting - www.trabin.com.br
*Blog:* http://lgerardlucas.blogspot.com/
*twitter:* http://twitter.com/lgerardlucas


Em 18 de fevereiro de 2014 16:38, Prof. Cleverson <
prof_clever...@uniguacu.edu.br> escreveu:

> Tenho a seguinte consulta que retorna apenas 1 registro de 10 colunas:
> select * from tac_avaliacao left join tac_nota on (codava=avanot) where
> hisnot=359921 and fasava=81
>
> a tabela avaliação tem 15000 registros
> a tabela de notas tem 660000 registros
>
> explain:
> "Nested Loop  (cost=0.00..12474.40 rows=1 width=46) (actual
> time=24228.265..45081.510 rows=1 loops=1)"
> "  Join Filter: (tac_avaliacao.codava = tac_nota.avanot)"
> "  Rows Removed by Join Filter: 1025"
> "  ->  Index Scan using tac_avaliacao_fasava_idx on tac_avaliacao
>  (cost=0.00..4.55 rows=1 width=29) (actual time=0.020..1.927 rows=513
> loops=1)"
> "        Index Cond: (fasava = 81)"
> "  ->  Seq Scan on tac_nota  (cost=0.00..12469.80 rows=4 width=17) (actual
> time=44.727..87.866 rows=2 loops=513)"
> "        Filter: (hisnot = 359921)"
> "        Rows Removed by Filter: 669822"
> "Total runtime: 45081.543 ms"
>
> pq será que isto demora 45 segundos? Algum indice não está sendo usado?
>
> --
>   .~.    Prof. Cleverson B. Klettenberg
>  / v \   prof_clever...@uniguacu.edu.br
> /(   )\
>  ^^-^^   Seja Livre!
>
> _______________________________________________
> pgbr-geral mailing list
> pgbr-geral@listas.postgresql.org.br
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a