1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Whats faster, sorting in Database or PHP?

Discussion in 'XenForo Development Discussions' started by Marcus, Aug 22, 2013.

  1. Marcus

    Marcus Well-Known Member

    The Watched Threads query is quite slow with more than 0.05 seconds on my test installation. When I remove sorting, it is noticeably faster. It is even more faster when you don't set any limit. Do you skip sorting and limit in the database and delegate these tasks to php by purpose?
  2. Jeremy

    Jeremy Well-Known Member

    I prefer the query because the code to sort would be repeated constantly and could get quite convoluted if improper. It is also extra coding I see no need for.

    As for the limit, that's almost a necessity if you want your forum to function well.
    bousaid likes this.
  3. LiquidPro

    LiquidPro Active Member

    You could add the appropriate index to the table in MySQL and that would speed up the query.

Share This Page