In order to minimize yield losses due to excursions, when a process or a tool shifts out of specifications, an algorithm is proposed to reduce the scope of analysis and provide in real time the number of lots potentially impacted. The algorithm is based on a Permanent Index per Context (IPC). The IPC allows a very large amount of data to be managed and helps to compute global risk indicators on production. The information provided by the IPC allows for the quick quantification of the potential loss in the production, and the identification of the set of production tools most likely to be the source of the excursion and the set of lots potentially impacted. A prototype has been developed for the defectivity workshop. Results show that the time of analysis can be strongly reduced and the average cycle time improved.