Search Postgresql Archives

Re: Avoiding evaluating functions twice.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Tuesday 04 October 2005 17:25, Tom Lane wrote:
> > han.holl@xxxxxxxxxxxxxxxxxxxx writes:
> > > select expensive_function(table) from table
> > >                      where expensive_function(table) is not null;
> > >
> > > Is there a way to avoid that expensive_function is evaluated twice (if
> > > it's not null) ?
> >
> > You can do something like this:
> >
> > select f from
> > (select expensive_function(table) as f from table offset 0) ss
> > where f is not null;

Why the offset 0?
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@xxxxxxxxxxxxx
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux