Tag Info

New answers tagged

0

SHOW CREATE TABLE -- need to see the PRIMARY KEY and the "index". 100-1000 is optimal (10K might be ok) for "batching" INSERTs -- That is, a single INSERT statement with 100 to 1000 rows in it. You have shown a single row being inserted. Will it work change to values ('a', 'b', 3), ('c', 'd', 4), ... That might give you a 10-fold speedup. That is also ...


2

Since you're trying to serialize work, I'd update a record in a table. CREATE TABLE task_keys ( task varchar(10) primary key, last_executed timestamp with time zone not null, by_worker_id integer ); INSERT INTO task_keys(task, last_executed) VALUES ('FOO', '-infinity'); then to see if you can run a task yet: UPDATE task_keys SET last_executed = ...



Top 50 recent answers are included