Kaushik - Updating the SQL to retain at least 5 artifacts from every stage