We tried using this query below to generate 5+ million records with nanoid, but got stuck by this error cannot start commands during a parallel operation
INSERT INTO __map_table__(old,new)
SELECT id, nanoid() FROM __old_table__;
we resolve this by introducing COST lower than or equal to 50
...
RETURNS text -- A randomly generated NanoId String
LANGUAGE plpgsql
VOLATILE
PARALLEL SAFE
COST 10 -- added
...
I'm not an expert on this, so is this a legit solution to solve this kind of problem or is there another way?
If this is good enough, I'll create PR.
We tried using this query below to generate 5+ million records with
nanoid, but got stuck by this errorcannot start commands during a parallel operationwe resolve this by introducing
COSTlower than or equal to 50... RETURNS text -- A randomly generated NanoId String LANGUAGE plpgsql VOLATILE PARALLEL SAFE COST 10 -- added ...I'm not an expert on this, so is this a legit solution to solve this kind of problem or is there another way?
If this is good enough, I'll create PR.