Re: [PERFORM] SQL Function Performance

2006-02-17 Thread Mark Liberman
Title: RE: [PERFORM] SQL Function Performance > in my case; both direct query and sql function gererate same execution plan. Also, execution plan belongs to the sql function better than direct sql > query plan. But, direct sql result comes less than 1 second. sql function result comes

Re: [PERFORM] SQL Function Performance

2006-02-17 Thread Mark Liberman
Title: RE: [PERFORM] SQL Function Performance I've run into this issue. It basically comes down to the plan that is being used inside the function is not the same as the plan used when you issue the query manually outside of the function.  Although I'm no expert on when plans ar

Re: [PERFORM] SQL Function Performance

2006-02-14 Thread Adnan DURSUN
    ---Original Message---   From: Michael Fuhr Date: 02/14/06 23:05:55 To: Adnan DURSUN Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] SQL Function Performance   >On Tue, Feb 14, 2006 at 11:33:57AM +0200, Adnan DURSUN wrote: >> ->  Nested Loop

Re: [PERFORM] SQL Function Performance

2006-02-14 Thread Michael Fuhr
On Tue, Feb 14, 2006 at 11:33:57AM +0200, Adnan DURSUN wrote: > -> Nested Loop (cost=5.90..267.19 rows=3 width=101) (actual > time=76.240..30974.777 rows=63193 loops=1) > -> Nested Loop (cost=5.90..123.48 rows=26 width=73) (actual > time=32.082..4357.786 rows=14296 loops

Re: [PERFORM] SQL Function Performance

2006-02-14 Thread Adnan DURSUN
  From: Michael Fuhr Date: 02/14/06 03:32:28 To: Tom Lane Cc: Adnan DURSUN; pgsql-performance@postgresql.org Subject: Re: [PERFORM] SQL Function Performance   On Mon, Feb 13, 2006 at 07:57:07PM -0500, Tom Lane wrote: >> "Adnan DURSUN" <[EMAIL PROTECTED]> writes: &

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Michael Fuhr
On Mon, Feb 13, 2006 at 07:57:07PM -0500, Tom Lane wrote: > "Adnan DURSUN" <[EMAIL PROTECTED]> writes: > EXPLAIN ANALYZE EXECUTE stmt (...); > > >Here is the EXPLAIN ANALYZE output for prepared statement : > > This is exactly the same as the other plan --- you did not parameterize > the

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Tom Lane
"Adnan DURSUN" <[EMAIL PROTECTED]> writes: EXPLAIN ANALYZE EXECUTE stmt (...); >Here is the EXPLAIN ANALYZE output for prepared statement : This is exactly the same as the other plan --- you did not parameterize the query. To see what's going on, you need to insert PREPARE parameters in

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Adnan DURSUN
---Original Message---   From: Mark Liberman Date: 02/14/06 01:46:16 To: Adnan DURSUN; pgsql-performance@postgresql.org Subject: RE: [PERFORM] SQL Function Performance   >> in my case; both direct query and sql function gererate same execution plan. Also, execution plan belo

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Adnan DURSUN
>From: Mark Liberman >Date: 02/13/06 22:09:48 >To: Adnan DURSUN; pgsql-performance@postgresql.org >Subject: RE: [PERFORM] SQL Function Performance   >I've run into this issue. It basically comes down to the plan that is being used inside the function is not the same as

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Adnan DURSUN
  From: Michael Fuhr Date: 02/13/06 07:46:05 To: Adnan DURSUN Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] SQL Function Performance   On Sun, Feb 12, 2006 at 10:25:28PM +0200, Adnan DURSUN wrote: >> My database has an SQL function. The result co

Re: [PERFORM] SQL Function Performance

2006-02-13 Thread Adnan DURSUN
  From: Michael Fuhr Date: 02/13/06 07:46:05 To: Adnan DURSUN Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] SQL Function Performance   On Sun, Feb 12, 2006 at 10:25:28PM +0200, Adnan DURSUN wrote: >> My database has

Re: [PERFORM] SQL Function Performance

2006-02-12 Thread Michael Fuhr
On Sun, Feb 12, 2006 at 10:25:28PM +0200, Adnan DURSUN wrote: > My database has an SQL function. The result comes in 30-40 seconds > when i use the SQL function. On the other hand; The result comes > 300-400 milliseconds when i run the SQL statement. Any idea ?? Have you analyzed the tables? If t

Re: [PERFORM] SQL Function Performance

2006-02-12 Thread andrew
If you have only recently analyzed the tables in the query, close your psql session (if that's what you were using) and then restart it. I've gotten burned by asking a query using the function, which I believe is when PG creates the plan for the function, and then making significant changes to t

[PERFORM] SQL Function Performance

2006-02-12 Thread Adnan DURSUN
              Hi all,               My database has an SQL function. The result comes in 30-40 seconds when i use the SQL function. On the other hand; The result comes         300-400 mill

Re: [PERFORM] SQL Function performance

2005-10-04 Thread Jim C. Nasby
On Thu, Sep 29, 2005 at 10:54:58PM +0300, [EMAIL PROTECTED] wrote: > Hi All, > > I have a SQL function like : > > CREATE OR REPLACE FUNCTION > fn_get_yetkili_inisyer_listesi(int4, int4) > RETURNS SETOF kod_adi_liste_type AS > $BODY$ > SELECT Y.KOD,Y.ADI >FROM T_YER Y > WHERE EX

[PERFORM] SQL Function performance

2005-09-29 Thread adnandursun
Hi All, I have a SQL function like : CREATE OR REPLACE FUNCTION fn_get_yetkili_inisyer_listesi(int4, int4) RETURNS SETOF kod_adi_liste_type AS $BODY$ SELECT Y.KOD,Y.ADI FROM T_YER Y WHERE EXISTS (SELECT 1 FROM T_GUZER G WHERE (G.BIN_YER_KOD = $1 OR COALESCE($1,0)=0