There are times when keying can become pretty difficult, especially if you get to add stock material to your plates, and this is a task that is usually one of the most important ones to get a final touch your shot. So when your footage has a lot of details and is proboblay shot on black, like smoke, fire or in my example a firework, it can be helpful to use a logarithmic approach in terms of keying.
So it is pretty simple. Use a Colorspace Node to convert your material from sRGB or Linear (depending on how your source comes in) to Cineon (log)
When you add a Keyer node afterwards you will notice, that the LumaKeyer will provide way more details than before. This can be handy especially when it comes to keying smoke or other wispy elements. Now an experienced compositor might say, why I am not screening or adding the stock material on top of my other layers. Well, this can be done as well, and you won't loose detail at all. BUT , quite often you have to split your comp into layers, especially when then film you are working on is converted into stereo later on. If you add all your stock footage on top of each layer, the conversion company will have a hard time to recreate the look you have created when splitting up all the elements into 2views. Further on having a matte for your stock can have more advantages as well. Say you want to add a glow to the firework, but you don't want the background of your stock to glow as well. Now when having a nice matte, you can limit the glow to the firework only.
Take a look at the example here and play around with keying in Log space, it is a trick that often helps when keying is particularly difficult.