Lookup Pattern: Cascading

Published Mar 25 2019 02:16 PM 246 Views
Not applicable
First published on MSDN on Nov 22, 2008

The cascading lookup pattern uses two lookup transforms with different cache modes . A common use of this pattern is when your data flow is inserting new rows into your reference table.

The first lookup in the chain is set to Full cache mode. Since it creates its cache before the data flow begins, it will only have the keys that exist before the package was executed.

A second lookup is hooked up to the No Match output of the first, using a Partial Cache mode. This one will pick up any rows that have been added since the data flow began. We hookup any logic needed to generate the key, or insert the row into the database into the No Match output of the second lookup.

Note, you don’t really need that first lookup – you could accomplish the same thing with a single lookup in a partial cache mode. But if you’re processing a good number of rows, and a large number of your keys already exist, the first lookup will improve your overall performance.

Make sure that you do not enable the Miss Cache ("Enable cache for rows with no matching entries" on the advanced options page ). If you do, the partial cache won't go to the database the next time the key value comes in again.

%3CLINGO-SUB%20id%3D%22lingo-sub-387503%22%20slang%3D%22en-US%22%3ELookup%20Pattern%3A%20Cascading%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-387503%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Nov%2022%2C%202008%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EThe%20cascading%20lookup%20pattern%20uses%20two%20lookup%20transforms%20with%20different%20%3CA%20href%3D%22http%3A%2F%2Fblogs.msdn.com%2Fmattm%2Farchive%2F2008%2F10%2F18%2Flookup-cache-modes.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20cache%20modes%20%3C%2FA%3E%20.%20A%20common%20use%20of%20this%20pattern%20is%20when%20your%20data%20flow%20is%20inserting%20new%20rows%20into%20your%20reference%20table.%3C%2FP%3E%0A%20%20%3CP%3EThe%20first%20lookup%20in%20the%20chain%20is%20set%20to%20Full%20cache%20mode.%20Since%20it%20creates%20its%20cache%20before%20the%20data%20flow%20begins%2C%20it%20will%20only%20have%20the%20keys%20that%20exist%20before%20the%20package%20was%20executed.%3C%2FP%3E%0A%20%20%3CP%3EA%20second%20lookup%20is%20hooked%20up%20to%20the%20No%20Match%20output%20of%20the%20first%2C%20using%20a%20Partial%20Cache%20mode.%20This%20one%20will%20pick%20up%20any%20rows%20that%20have%20been%20added%20since%20the%20data%20flow%20began.%20We%20hookup%20any%20logic%20needed%20to%20generate%20the%20key%2C%20or%20insert%20the%20row%20into%20the%20database%20into%20the%20No%20Match%20output%20of%20the%20second%20lookup.%3C%2FP%3E%0A%20%20%3CP%3ENote%2C%20you%20don%E2%80%99t%20really%20need%20that%20first%20lookup%20%E2%80%93%20you%20could%20accomplish%20the%20same%20thing%20with%20a%20single%20lookup%20in%20a%20partial%20cache%20mode.%20But%20if%20you%E2%80%99re%20processing%20a%20good%20number%20of%20rows%2C%20and%20a%20large%20number%20of%20your%20keys%20already%20exist%2C%20the%20first%20lookup%20will%20improve%20your%20overall%20performance.%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F99420iEA7DDB4775D61F41%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EMake%20sure%20that%20you%20do%20not%20enable%20the%20Miss%20Cache%20(%22Enable%20cache%20for%20rows%20with%20no%20matching%20entries%22%20on%20the%20%3CA%20href%3D%22http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fms189962.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20advanced%20options%20page%20%3C%2FA%3E%20).%20If%20you%20do%2C%20the%20partial%20cache%20won't%20go%20to%20the%20database%20the%20next%20time%20the%20key%20value%20comes%20in%20again.%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-387503%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Nov%2022%2C%202008%20The%20cascading%20lookup%20pattern%20uses%20two%20lookup%20transforms%20with%20different%20cache%20modes.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-387503%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Elookup%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Mar 25 2019 02:16 PM
Updated by: