Skip site navigation (1) Skip section navigation (2)

Re: Weird performance drop

From: Vincenzo Romano <vincenzo(dot)romano(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Weird performance drop
Date: 2007-03-30 06:36:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Friday 30 March 2007 01:12 Dave Dutcher wrote:
> > From: pgsql-performance-owner(at)postgresql(dot)org
> > [mailto:pgsql-performance-owner(at)postgresql(dot)org] On Behalf Of
> > Vincenzo Romano
> >
> > I thought that the query planner usually did a bad job on
> > function bodies
> > because they'd appear opaque to it.
> > In this case it seems to me that the body is opaque only if I
> > use the "like"
> > operator.
> If you run explain on a query that looks like "select * from a_table where
> a_column like 'foo%'" (and you have the appropriate index) you will see
> that postgres rewrites the where clause as "a_column >= 'foo' and a_column
> < 'fop'".  I think your problem is that the query is planned when the
> function is created, and at that time postgres doesn't know the value you
> are comparing against when you use the like operator, so postgres can't
> rewrite the query using >= and <.  The problem doesn't happen for plain
> equality because postgres doesn't need to know anything about what you are
> comparing against in order to use equality.
> Somebody else can correct me if I'm wrong.
> Dave

Is there any "workaround"?

In my opinion the later the query planner decisions are taken the more
effective they can be.
It could be an option for the function (body) to delay any query planner

Vincenzo Romano
Maybe Computers will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1987]

In response to


pgsql-performance by date

Next:From: Marc MaminDate: 2007-03-30 07:07:53
Subject: Re: Scaling SELECT:s with the number of disks on a stripe
Previous:From: Erik JonesDate: 2007-03-30 05:22:52
Subject: Re: Shared buffers, db transactions commited, and write IO on Solaris

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group