Queue counting Implementation for RDBMS