Thread: Wrong statistics for overloaded functions

Wrong statistics for overloaded functions

From
Erwin Brandstetter
Date:
Aloha!

I have been observing irregularities in the function statistics for some time. Now I have investigated and believe to
havefound the cause. 
Everything is here, including a proposed fix:
     http://code.pgadmin.org/trac/ticket/325


Regards
Erwin

Re: Wrong statistics for overloaded functions

From
Guillaume Lelarge
Date:
On Wed, 2011-07-06 at 21:22 +0200, Erwin Brandstetter wrote:
> Aloha!
>
> I have been observing irregularities in the function statistics for some time. Now I have investigated and believe to
havefound the cause. 
> Everything is here, including a proposed fix:
>      http://code.pgadmin.org/trac/ticket/325
>

The fix you propose requires from us to write a patch for PostgreSQL
(which won't be available to users before 9.2) for something we can
already do right into pgAdmin. Instead of filtering with the name of the
schema and the function, we should use its OID. This way, we could fix
1.12, and 1.14 really quickly.


--
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com


Re: Wrong statistics for overloaded functions

From
Erwin Brandstetter
Date:
On 07.07.2011 08:52, Guillaume Lelarge wrote:
> On Wed, 2011-07-06 at 21:22 +0200, Erwin Brandstetter wrote:
>> Aloha!
>>
>> I have been observing irregularities in the function statistics for some time. Now I have investigated and believe
tohave found the cause. 
>> Everything is here, including a proposed fix:
>>       http://code.pgadmin.org/trac/ticket/325
>>
> The fix you propose requires from us to write a patch for PostgreSQL
> (which won't be available to users before 9.2) for something we can
> already do right into pgAdmin. Instead of filtering with the name of the
> schema and the function, we should use its OID. This way, we could fix
> 1.12, and 1.14 really quickly.

Yeah, that's even better. Makes the query simpler, too.
I was unsure whether funcid was known at the time of the query.

I do wonder, however, why the function arguments, part of the function signature, would not be included in
pg_catalog.pg_stat_user_functions.
Would you think this is worthy of a suggestion to the postgres people?

Regards
Erwin

Re: Wrong statistics for overloaded functions

From
Guillaume Lelarge
Date:
On Thu, 2011-07-07 at 14:08 +0200, Erwin Brandstetter wrote:
> On 07.07.2011 08:52, Guillaume Lelarge wrote:
> > On Wed, 2011-07-06 at 21:22 +0200, Erwin Brandstetter wrote:
> >> Aloha!
> >>
> >> I have been observing irregularities in the function statistics for some time. Now I have investigated and believe
tohave found the cause. 
> >> Everything is here, including a proposed fix:
> >>       http://code.pgadmin.org/trac/ticket/325
> >>
> > The fix you propose requires from us to write a patch for PostgreSQL
> > (which won't be available to users before 9.2) for something we can
> > already do right into pgAdmin. Instead of filtering with the name of the
> > schema and the function, we should use its OID. This way, we could fix
> > 1.12, and 1.14 really quickly.
>
> Yeah, that's even better. Makes the query simpler, too.
> I was unsure whether funcid was known at the time of the query.
>

Fixed.

> I do wonder, however, why the function arguments, part of the function signature, would not be included in
pg_catalog.pg_stat_user_functions.
> Would you think this is worthy of a suggestion to the postgres people?
>

Might be. They could reply that you already have this information from
the pg_proc catalog.


--
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com