stored procedure optimisation... - Mailing list pgsql-general

From Anton Melser
Subject stored procedure optimisation...
Date
Msg-id 92d3a4950702261024g60b3f804r696b346b7b24aa6@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi,
I need to analyse some html to get some links out, and with only 25
lines in exports_tmp_links (and text_to_parse no more than around
10KB) this function has taken 10 minutes and counting. Something
horribly wrong is going on here! Can someone give me any pointers?
Cheers
Anton

delete from tmp_links_all;
analyze exports_tmp_links;

FOR tempRow IN SELECT * FROM exports_tmp_links LOOP
    startString := tempRow.text_to_parse;
    LOOP

        linkString := substring(startString, '(linkadministration.*=[0-9]+)');
        IF linkString is null THEN
            EXIT;
        END IF;

        newlinkid := substring(linkString,'([0-9]+)');
        INSERT INTO tmp_links_all
(link_id,content_section,item_id,item_name,location_of_link)
        values (newlinkid,tempRow.content_section,tempRow.item_id,
tempRow.item_name, tempRow.location_of_link);

        startString := substring(startString from position(newlinkid in startString));

    END LOOP;
END LOOP;

analyze tmp_links_all;

pgsql-general by date:

Previous
From: RPK
Date:
Subject: Re: Composite Keys
Next
From: Alvaro Herrera
Date:
Subject: Re: Composite Keys