\set seed random(1, 1000000000000)
\set i0 pr_perm(0, 5, :seed)
\set i1 pr_perm(1, 5, :seed)
\set i2 pr_perm(2, 5, :seed)
\set i3 pr_perm(3, 5, :seed)
\set i4 pr_perm(4, 5, :seed)
INSERT INTO perm_count AS pc (perm)
  VALUES (:i0 + :i1*10 + :i2*100 + :i3*1000 + :i4*10000)
  ON CONFLICT (perm) DO UPDATE SET cnt = pc.cnt+1;
