Re: How to push predicate down

From: Volodymyr Kostyrko <c(dot)kworr(at)gmail(dot)com>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to push predicate down
Date: 2012-01-26 14:49:59
Message-ID: 4F216817.4080800@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

salah jubeh wrote:
>
> Hello Guys,
>
> In the past I had a view defined as follows
>
> CREATE view abcd as
> SELECT whatever ...... --- query1
>
> Some business requierments came up and I had to change it like this
>
> CREATE view abcd as
> SELECT whatever ...... --- query1
> UNION
> SELECT whatever ......---- query2

1. You sure you need UNION and not UNION ALL?

2. Can you post more detail example?

For example:

select anything from first_table
union
select anything from second_table
where anything == something;

This way WHERE clause is a part of second subselect and will not be
propagated to the first one.

--
Sphinx of black quartz judge my vow.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-01-26 14:50:14 Re: Let-bindings in SQL statements
Previous Message Szymon Guz 2012-01-26 14:41:25 Re: Let-bindings in SQL statements