On Thu, Nov 07, 2002 at 12:03:12AM -0500, lewellen wrote: > Hi all- > > I would like to use a mySQL table as a huge FIFO queue (too big > for a hash) in a Perl program. However, I am worried about speed. > A standard way to get an item off the queue would be to issue a > SELECT statement sorted on the index, and then to just make one call > to a row-fetching method (such as fetchrow_array() ). (I don't want > to iterate through the entire result, because there will be many > inserts to the queue in the meantime.) My worry is that executing a > SELECT statement sorted on the index every time I want to shift an > item off the queue will be too slow. Is there a simple and fast > alternative for taking the first row off of a table? Thanks.
It'd be quite fast, I think. SELECT * FROM queue ORDER BY foo LIMIT 1; and then delete the record when you're done with it. But "fast" is relative. It'd be a few a few msec at the most. Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/ MySQL 3.23.51: up 92 days, processed 1,937,295,877 queries (241/sec. avg) --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php