DataTables + php + mysql ... slow

DataTables + php + mysql ... slow

tomy300tomy300 Posts: 16Questions: 2Answers: 0
edited February 2013 in General
Hi,

I'm new here and for now I apprecialte a lot the feature of DataTables.
I have put a test file with the server side example with a mysql database and it's kinda slow when I change row pagination, or when I do a sort colomn.

I understand that each time it goes on the database and read the data and it's why it's take a bit longer.
I would like to know if it will be a good Idea to read the data from the database and push it n XML directly so no need to
reload the data each time. the update could be made directly in both mysql database and the Xml.

I just want to make it fast, and for security reason ... I just don't know if it secure to do this.

also it's there an example of updating the data to php to mysql. I only have the read example...

thanks

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    How many works are you working with? Reading from a MySQL db, unto 50'000+ rows use client-side processing and for more use server-side processing. Both should be plenty fast - if they are not, please link to a test case.

    Allan
  • tomy300tomy300 Posts: 16Questions: 2Answers: 0
    Hi,

    there's only 57 row in the database, here the link for testing http://debugger.ca/mc/mcadmin/
    when I change page it's kinda slow, I tought it would be faster than that since it's only 57 row... or it's the server speed, even if I sort by colomn it's slow and a message apear telling that i must wait the data.

    I use ajax, the same example that on the exemple page.

    thanks for helping.
  • austinbestaustinbest Posts: 4Questions: 0Answers: 0
    I use this with thousands of rows and no issues. Looking at a debugger, your problem lies in your ajax, not in data tables. It took 1.57 seconds to process your ajax. Maybe post the actual PHP side as well as the mysql table structure and you can get help with that :)
  • tomy300tomy300 Posts: 16Questions: 2Answers: 0
    I use the same php code in this exemple

    http://www.datatables.net/release-datatables/examples/data_sources/server_side.html
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    I agree with austinbest - I'm seeing up to 1 second for the Ajax request to be processed. I'd start by profiling the PHP and generated MySQL queries. You might need to add indexes to your DB for example.

    Allan
This discussion has been closed.