Re: function runs slow

From: "Charles Holleran " <scorpdaddy(at)hotmail(dot)com>
To: "pgsql-novice(at)postgresql(dot)org " <pgsql-novice(at)postgresql(dot)org>
Subject: Re: function runs slow
Date: 2010-07-15 09:03:58
Message-ID: BAY126-DS5D96AD15C627711C38AF9CEBB0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Yep. That was it. Thanks so much.

Charlie

-----Original Message-----
From: "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Date: Thu, 15 Jul 2010 05:47:59
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [NOVICE] function runs slow

In response to Charles Holleran :
> Why is it slow when the same un-functionized query was fast?  The tbl_a has
> est. 30,000,000 records.  It has an index for (x,y) pairs.  It has an index for
> date_observed.  So good results on the straight query.  Where did I go wrong
> with the function?

The planner isn't able to choose the right plan because he don't know
the actual parameters.

You can do EXECUTE 'string that contains your query' to enforce
re-planning the query.

http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

Browse pgsql-novice by date

  From Date Subject
Next Message Tovo J. RABEMANANTSOA 2010-07-15 12:30:06 Could not start server
Previous Message Siddharth Saha 2010-07-15 06:00:54 [NOVIE] raise notice not working for nested function calls