Em 2 de junho de 2017 14:34, Fabrízio de Royes Mello < fabri...@timbira.com.br> escreveu:
> > Em 2 de junho de 2017 12:32, Alexsander Rosa <alexsander.r...@gmail.com> > escreveu: > > (...) > > Coloquei STABLE e não mudou nada: > > > > Roda o ajuste abaixo (além do STABLE) e roda novamente o teste: > > ALTER FUNCTION sp_teste(text) COST 10; > > laboratorio:rnge2=# *ALTER FUNCTION sp_teste(text) COST 10;* ALTER FUNCTION laboratorio:rnge2=# *EXPLAIN (ANALYZE, TIMING, BUFFERS) SELECT sp_teste('43170605563868000113657010000004061895261728');* QUERY PLAN ------------------------------------------------------------------------------------------ Result (cost=0.00..0.04 rows=1 width=0) (actual time=1494.473..1494.473 rows=1 loops=1) Buffers: shared hit=18939 read=123331 Total runtime: 1494.496 ms (3 rows) laboratorio:rnge2=# *SELECT pg_get_functiondef('sp_teste'::regproc);* pg_get_functiondef ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION rnx.sp_teste(chave text) + RETURNS text + LANGUAGE plpgsql + STABLE COST 10 + AS $function$ + DECLARE + BEGIN + PERFORM num_cupom FROM cf_cupom WHERE nfce_chave_acesso_fk = chave;+ Return 'OK'; + END; + $function$ + (1 row) Atenciosamente, Alexsander da Rosa
_______________________________________________ pgbr-geral mailing list pgbr-geral@listas.postgresql.org.br https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral