Replace Count(1) by Count(*)
Boths are similar but Count(*)
is a little bit faster than Count(1)
(https://pgblog.bashtanov.com/2019/01/24/count-vs-count1-vs-countid/). But generally it is better semantic (usage of 1 was an old trick when * was slower).