title: Why do we need message brokers like RabbitMQ over a database like PostgreSQL?
body: <p>I am new to message brokers like <a href="https://www.rabbitmq.com/" rel="noreferrer">RabbitMQ</a> which we can use to create tasks / message queues for a scheduling system like <a href="http://www.celeryproject.org/" rel="noreferrer">Celery</a>.</p>
  
  <p>Now, here is the question:</p>
  
  <ul>
  <li><p>I can create a table in <a href="https://www.postgresql.org/" rel="noreferrer">PostgreSQL</a> which can be appended with new tasks and consumed by the consumer program like Celery.</p></li>
  <li><p>Why on earth would I want to setup a whole new tech for this like RabbitMQ?</p></li>
  </ul>
  
  <p>Now, I believe scaling cannot be the answer since our database like PostgreSQL can work in a distributed environment.</p>
  
  <p>I googled for what problems does the database poses for the particular problem, and I found:</p>
  
  <ul>
  <li>polling keeps the database busy and low performing</li>
  <li>locking of the table -> again low performing</li>
  <li>millions of rows of tasks -> again, polling is low performing</li>
  </ul>
  
  <p>Now, how does RabbitMQ or any other message broker like that solves these problems?</p>
  
  <p>Also, I found out that <code>AMQP</code> protocol is what it follows. What's great in that?</p>
  
  <p>Can <a href="https://redis.io/" rel="noreferrer">Redis</a> also be used as a message broker? I find it more analogous to Memcached than RabbitMQ.</p>
  
  <p>Please shed some light on this!</p>