Re: Is it possible to decide the order of where conditions in Flink SQL

Posted by sri hari kali charan Tummala on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Is-it-possible-to-decide-the-order-of-where-conditions-in-Flink-SQL-tp29061p29064.html

try cte common table expressions if it supports or sql subquery.

On Fri, Jul 26, 2019 at 1:00 PM Fanbin Bu <[hidden email]> wrote:
how about move query db filter to the outer select.

On Fri, Jul 26, 2019 at 9:31 AM Tony Wei <[hidden email]> wrote:
Hi,

If I have multiple where conditions in my SQL, is it possible to specify its order, so that the query 
can be executed more efficiently?

For example, if I have the following SQL, it used a heavy UDF that needs to access database.
However, if I can specify the order of conditions is executing `!user.is_robot` first then executing
UDF, it will reduce the number of database access. Those records with `true` in `user.is_robot` will
be dropped earlier and don't need to access database. 

select * 
from users
where !user.is_robot and UDF_NEED_TO_QUERY_DB(user)

Thanks,
Tony Wei 


--
Thanks & Regards
Sri Tummala