> One thing to watch out for - using SQLITE for a FIFO will have limited 
> throughput, because commits will have to be done after inserting or removing 
> each entry. 

This is fine for now.  Wiling to migrate to MySQL, etc if needed for speed.


> This might not be an issue in some situations - I have actually 
> implemented a FIFO to communicate between two tasks where the work-per-entry 
> was 
> significant, the transaction rate was low, and the protection against 
> accidental 
> loss was paramount.
> 

Same deal.

Do you have any suggestions?  I'm very new SQL beyond the basic "CRUD" level.

As I mentioned in the other post, I'm guessing I need three tables...

task_log => (id, task_data, time_stamp)
task_fifo = > (id, fk_task_log)
task_status_log => (id, fk_task_log, status_code, time_stamp)

And in psudo SQL:  

TRIGGER ON INSERT INTO task_log:
BEGIN
    INSERT INTO task_fifo (fk_task_log) VALUES (NEW.id)
END;

TRIGGER ON DELETE FROM task_fifo:
BEGIN
        INSERT INTO task_status_log VALUES (OLD.fk_task_log, "CLAIMED")
END;


And then, again in psudo SQL, the worker does something like:

DELETE 1 OLDEST FROM task_fifo;

But I am not sure how get access to the task_id for the worker to retrieve the 
necessary data.

(Is this even the correct approach?)

Thank you,
:)


      

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to