MySQL circular buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm looking at implementing a database-level stack for a (multi stack)
mail merge queue (able to queue up to 1 million messages per stack).
Current workflow:

server 1 (containing main db) transmits data sets (used to populate
mail merge template) to server 2
server 2 web-facing script (script 1) puts data sets onto stack (db)
server 2 mail process script (script 2) pulls single data block (say
100 rows) from front of stack (fifo), merges the data with the
template and sends data to smtp process
server 2 script 2 removes "processed" block of rows

The problems I am considering include keeping track of the value of
the primary key across multiple instances of script 2 (the script will
run from a cron), whether to select by limit or range (i.e. stack_id >
500 && stack_id < 601 vs where stack_id = 500 limit 100) and looping
the index back to zero while ensuring there is no data that hasn't
been deleted.

So - it seems easier to avoid these problems and implement a circular
buffer :) What I would like to know is if anybody has experience
implementing this sort of data structure in MySQL (linked list?) or
any advice.

There don't seem to be any current implementations so the last
question is - is there a good reason for that? Too many overheads? I
know this sort of structure is best kept in memory and not on disk,
but I am not sure of any other solution to a queue this size.

Any comments welcome. Many thanks,


Andy

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux