stored procedure optimisation...

From: "Anton Melser" <melser(dot)anton(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: stored procedure optimisation...
Date: 2007-02-26 18:24:57
Message-ID: 92d3a4950702261024g60b3f804r696b346b7b24aa6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fabio D'Ovidio 2007-02-26 18:34:25 psql : password on Win32
Previous Message RPK 2007-02-26 18:23:43 Re: Composite Keys