[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple sqlworkers
From: |
Thomas Bereknyei |
Subject: |
Re: Multiple sqlworkers |
Date: |
Fri, 12 Jun 2020 11:39:11 -0400 |
Works like a charm! I also have some other edits that I use for
postgres specifically that are useful when there are very many small
jobs and used the SKIP LOCKED feature. Something like this:
diff --git a/src/parallel b/src/parallel
index 943ec82..bc8fb0b 100755
--- a/src/parallel
+++ b/src/parallel
@@ -12631,8 +12631,8 @@ sub get_record($) {
my @retval;
my $table = $self->table();
my @v_cols = map { ", V$_" } (1..$self->max_number_of_args());
- my $v = $self->get("SELECT Seq, Command @v_cols FROM $table ".
-> > "WHERE Exitval = -1000 ORDER BY Seq LIMIT 1;");
+ my $v = $self->get("UPDATE $table Set exitval = -1220 WHERE Seq =
( SELECT seq from $table ".
+ "WHERE Exitval = -1000 FOR UPDATE SKIP LOCKED LIMIT 1)
RETURNING Seq, Command @v_cols;");
if($v->[0]) {
> my $val_ref = $v->[0];
> # Mark record as taken
> my $seq = shift @$val_ref;
> # Save the sequence number to use when running the job
> $SQL::next_seq = $seq;
-> $self->update("SET Exitval = ? WHERE Seq = ".$seq, -1220);
> my @command = split /\257 /, shift @$val_ref;
But that is very specific to postgres and you seem to be trying to
maintain compatibility.