Re: Stored procedure slower than sql?

From: "Matthew Peters" <matthew(at)haydrian(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Stored procedure slower than sql?
Date: 2006-10-26 16:21:37
Message-ID: 775F825B46B551499DC75DC4E92F80AB564D05@jupiter.ad.haydrian.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Parameterized.

IE (very simplified)

CREATE OR REPLACE FUNCTION my_function(IN param1 BIGINT, IN param2
INTEGER)
RETURNS my_type
SECURITY DEFINER
AS
$$
/* my_type = (a,b,c) */
Select a,b,c
FROM my_table
WHERE indexed_column = $1
AND partition_constraint_column = $2;
$$
LANGUAGE SQL;

Matthew A. Peters
Sr. Software Engineer, Haydrian Corp.
matthew(at)haydrian(dot)com
(mobile) 425-941-6566
Haydrian Corp.
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, October 26, 2006 9:15 AM
To: Matthew Peters
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Stored procedure slower than sql?
Importance: High

"Matthew Peters" <matthew(at)haydrian(dot)com> writes:
> How can a stored procedure containing a single query not implement the
> same execution plan (assumption based on the dramatic performance
> difference) that an identical ad-hoc query generates?

Parameterized vs non parameterized query?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Troy 2006-10-26 17:10:24 Re: commit so slow program looks frozen
Previous Message Tom Lane 2006-10-26 16:14:38 Re: Stored procedure slower than sql?