Home  >  Q&A  >  body text

redis 可以实现类似mysql的高级排序吗?

redis sort
能做类似
mysql
这样的排序吗?

SELECT id,weight,click FROM task ORDER BY weight DESC, click ASC

PHPzPHPz2760 days ago951

reply all(5)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-21 11:19:15

    Use redis ordered set to sort when inserting

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-21 11:19:15

    Don’t waste your efforts, no, just sit back and wait. http://redis.io/commands/SORT

    reply
    0
  • 黄舟

    黄舟2017-04-21 11:19:15

    Use memsql

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-21 11:19:15

    It is not supported directly, but you can design it, such as dividing the score into weight + (max_click - click)

    reply
    0
  • PHP中文网

    PHP中文网2017-04-21 11:19:15

    @finallygo’s method is generally feasible, but if it’s too complicated, it may not be supported well.

    reply
    0
  • Cancelreply