Speed up plpgsql that counts doc types in a loop?
Is there a way to speed up our plpgsql function that counts certain types of docs all in one query which is executed in a loop? ALL in one query? validador := (select count(id_doc) from webdte.doc_tip_cifra where id_doc = id_documento and id_tipo_cifra = 901); validador2 := (select count(id_doc) from webdte.doc_tip_cifra where id_doc = id_documento and id_tipo_cifra = 902); validador3 := (select count(id_doc) from webdte.doc_tip_cifra where id_doc = id_documento and id_tipo_cifra = 905); validador4 := (select count(id_doc) from webdte.doc_tip_cifra where id_doc = id_documento and id_tipo_cifra