Search Postgresql Archives

Re: Filter sequence

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

 



=?ISO-8859-1?Q?Andr=E9_Volpato?= <andre.volpato@xxxxxxxxxxxxxxxxxxxxx> writes:
> select u2.cod, u2.name
> from
> (
>     select u.cod, u.name
>     from users u
>     where age between 0 and 44 and sex='F'
>     group by u.cod, u.name
> ) u2
> group by u2.cod, u2.name
> having
>     getSalaryPeriod(1997,1999,u2.cod) > 1000

> I want the planner to filter the user age and sex (wich restricts the 
> results and groups the user cod), and after that, run getSalaryPeriod 
> ONLY in the results of the subquery u2. Instead, its filtering the age, 
> sex and the salary in the same point :

The standard hack is to add "OFFSET 0" to the subquery --- this will
serve as an "optimization fence" without actually changing its results.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[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