Em 2 de junho de 2017 16:40, Matheus de Oliveira <[email protected]>
escreveu:

> Isso aí pra mim tá com cara de plano de execução genérico. Mas pra ter
> certeza seria legal você instalar e habilitar o auto_explain, daí você
> configura `auto_explain.log_nested_statements = on`  e executa a função
> novamente, ele vai logar o plano de execução só daquela consulta no log.
>
>     postgres=# SELECT sp_teste('431706055638680001136570100000
> 04061895261728');
>     ... <poste o resultado> ...
>
>
O banco um Seq Scan... ignorou o índice.

central-rd540:5432:rnge2=# SELECT
sp_teste('43170605563868000113657010000004061895261728');
LOG:  duration: 1810.362 ms  plan:
Query Text: SELECT num_cupom FROM cf_cupom WHERE nfce_chave_acesso_fk =
chave
Seq Scan on cf_cupom  (cost=0.00..305178.52 rows=54145 width=4) (actual
time=1806.082..1810.358 rows=1 loops=1)
  Filter: ((nfce_chave_acesso_fk)::text =
'43170605563868000113657010000004061895261728'::text)
  Rows Removed by Filter: 10793976
LOG:  duration: 1834.088 ms  plan:
Query Text: SELECT sp_teste('43170605563868000113657010000004061895261728');
Result  (cost=0.00..0.26 rows=1 width=0) (actual time=1834.080..1834.080
rows=1 loops=1)
 sp_teste
----------
 OK


-- 
Atenciosamente,
Alexsander da Rosa
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a