Re: Query is fast and function is slow

From: Richard Ray <rray(at)mstc(dot)state(dot)ms(dot)us>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query is fast and function is slow
Date: 2006-12-07 17:10:56
Message-ID: Pine.LNX.4.64.0612071100530.16909@rray.drdc.mstc.ms.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 7 Dec 2006, Tom Lane wrote:

> 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.

I said my knowledge was pitiful
Changing both parameters to char(9) and name fixed the problem
It appears to be using the index
If time allows could you explain this a bit

Thanks
Richard

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Phillip Smith 2006-12-07 22:16:29 could not find pathkey item to sort
Previous Message Tom Lane 2006-12-07 16:40:26 Re: Query is fast and function is slow