Using a database table as a queue

前端 未结 9 2216
既然无缘
既然无缘 2020-12-02 07:45

I want to use a database table as a queue. I want to insert in it and take elements from it in the inserted order (FIFO). My main consideration is performance because I have

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 08:34

    Everything depends on your database engine/implementation.

    For me simple queues on tables with following columns:

    id / task / priority / date_added
    

    usually works.

    I used priority and task to group tasks and in case of doubled task i choosed the one with bigger priority.

    And don't worry - for modern databases "thousands" is nothing special.

提交回复
热议问题