Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FYI for others, such filtering is called predicate pushdown (I believe also called predicate hoisting sometimes). Example (and this is trivial but for illustration)

   select * from (select * from tbl) as subqry where subqry.col = 25
would be rewritten by any halfway decent optimiser to

   select * from (select * from tbl where tbl.col = 25) 
(and FTR the outermost select * would be stripped off as well).

Good DB optimisers do a whole load of that and much more.



Yeah, had to get quite well acquainted with query execution plans and the like a few years ago (And forgot most of it by now) because of diagnosing a SLOW query.

Joining onto either table a or table b is something that REALLY trips optimizers up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: