Search Postgresql Archives

Re: Function performance degrades after repeated execution

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

 





so 16. 11. 2019 v 16:46 odesílatel Ron <ronljohnsonjr@xxxxxxxxx> napsal:
On 11/16/19 8:22 AM, Dave Roberge wrote:
> Hi,
>
> We've been troubleshooting a slow running function in our postgres database. I've been able to boil it down to the simplest function possible. It looks like this:
>
> FOR rec IN select 1 as matchval FROM table1 t1, table2 t2
>    join table3 t3 on t3.col = t2.col
>    WHERE t1.col = id
> LOOP
>    IF rec.matchval > 0 THEN
>      co := co + 1;
>    END IF;
>    if co % 100 = 0 then
>      raise notice 'match value %', co;
>    end if;
> END LOOP;

Where are you joining table1 to either table2 or table3?

good shot - there is maybe unwanted cartesian product

Pavel


--
Angular momentum makes the world go 'round.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux