Re: [SQL] overload

2011-07-08 Thread lists-pgsql
Hi Viktor, I'm not sure what your requirements are in terms of performance and stability of the your result set. See Pavel's response. A cursor issues a single query and renders a single result set. The result set is static, the cursor just gives you finer control/performance when retrieving rows

Re: [SQL] overload

2011-07-08 Thread Pavel Stehule
Hello using a "window" implemented via LIMIT OFFSET is not good - it is solution on some systems where cursors are not available, but it is bad solution on PostgreSQL. Use a cursor instead - it is significantly more efective with less memory requests. Regards Pavel Stehule 2011/7/8 Viktor Bojov

Re: [SQL] overload

2011-07-08 Thread Viktor Bojović
Thanx Wayne, at the end i did it that way and it works. The code is below. CREATE FUNCTION pattern_counter1("patLength" integer) RETURNS character varying LANGUAGE plperl AS $_X$ my $rvCnt = spi_exec_query("select count(1) as cnt from entry"); #my $rowCountAll = $rvCnt->{processed}; my $row = $rvC

Re: [SQL] overload

2011-07-08 Thread lists-pgsql
I'm have the same situation with large tables. Take a look at using a cursor to fetch several thousand rows at a time. I presume what's happening is that perl is attempting to create a massive list/array in memory. If you use a cursor the list should only contain X number of rows where X in the