Re: Query much slower when run from postgres function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mario Splivalo <mario.splivalo@xxxxxxxxxx> writes:
> Is this difference normal?

It's hard to tell, because you aren't comparing apples to apples.
Try a prepared statement, like

prepare foo(int) as
SELECT
	COUNT(*)::int4
FROM
	_v1
WHERE
	service_id = $1
;

execute foo(504);

which should produce results similar to the function.  You could
then use "explain analyze execute" to probe further into what's
happening.

			regards, tom lane

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux