|
Archives of the TeradataForumMessage Posted: Wed, 20 Jan 2010 @ 14:53:24 GMT
You've hit a few tough issues with this one! 1. Inequality Join = join conditions involve only operations like <, <=, >, >=. Always been a source of performance problems. 2. Scalar subqueries = subqueries placed within SELECTed columns of the parent query. For example, www.teradataforum.com/teradata/20090902_161807.htm ["warfarin thread"] www.teradataforum.com/teradata/20030317_231946.htm Scalar subqueries were expected to be implemented seven years ago? Really? The first sign of them can only be found in Release 13! I mention the scalar subqueries because they would allow the use of the reference table to introduce the Minute IDs immediately in the SELECT without actually joining two tables. But this is only if scalar queries are not translated back to ordinary (outer) joins. I suspect (but did not try it) R13 implementation does the latter. Maybe there is an OLAP solution with some artificial tricks. Not sure it is worth spending time on it, though. If you just want something simple that only scans the main table once and does all calculations in a single pass (the most economical scenario) consider extending the CASE to include all the reference values. I admit there are a lot of them (but the fixed number of them, which is a rare bonus!) and the query won't look pretty but it will work. Well, you may hit the limit on the number of clauses in the CASE but that should be easy to fix by splitting into multiple CASEs or something. Now, I'll run and hide from any accusations of hard-coding reference values, not following the Great Metadata Management Imperatives or urban myths etc. Victor
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | |||||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | |||||||||||||||||||||||||||||||||||||||||||||||||||