META-501 changed some sqls and added pv update generator