On 2015-01-20 11:42, Ken Kixmoeller (ProFox) wrote:
I always pre-select, too, but I often do it in two steps. Pre-select query #1 is the simplest, fastest SQL which eliminates the obvious 99% of data
not needed for this answer. The second refines the raw results into the
precise ones. I find that two queries like this can run in 2-3 seconds,
where a single SQL statement to get the precise results can take 5x the
time. Plus, the two statements are easier to write!


I use this approach too. I absolutely hate these colossal must-all-be-done-in-one-super-huge-SQL statements, even if it's slightly faster because I design things to be easily maintainable, rather than uber-geek. If I'm having to work on these apps later, I don't want to be cursing my previous show-off SQLs that I then have a hard-time understanding all those years later. Likewise, if somebody has to maintain my code, I want it to be easy for them too. Honestly, 2 seconds extra is not gonna make a world of difference for most reports.

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to