Re: Query is fast and function is slow

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query is fast and function is slow
Date: 2006-12-07 16:40:26
Message-ID: 16166.1165509626@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)us> writes:
> On Thu, 7 Dec 2006, Thomas Pundt wrote:
>> Just a guess: is the column "doc_num" really of type text? Maybe using "text"
>> in the function lets the planner choose a sequential scan?

> Actually "doc_num" is char(9)
> I changed text to char(9) and got same slow results

You need to make the second argument type "name", too, if you have a lot
of users.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Ray 2006-12-07 17:10:56 Re: Query is fast and function is slow
Previous Message Thomas Pundt 2006-12-07 15:41:27 Re: Query is fast and function is slow