Datatables with huge data takes long time

Datatables with huge data takes long time

Srinivas-CSrinivas-C Posts: 4Questions: 1Answers: 0

I have around 50K data , got by running a sql query in python(data is in the form of list of tuples) .. which I rendered using for loop in Django template in table and then calling javascript datatable function for the created table to get its features applied to my table. But time taken to run the function is around 10-15sec. How can I reduce the time?
I am new to js.

Thanks in Advance

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 21,181Questions: 26Answers: 4,924
    Answer ✓

    rendered using for loop in Django template in table and then calling javascript datatable function for the created table to get its features applied to my table.

    The place to start is to determine which process is taking a long time. Also take a look at this FAQ for Datatables specific ways to improve speed. There are third party Django libraries that are built to handle Datatables Server Side Processing. I haven't tried them so not sure how well they work.

    Kevin

  • Srinivas-CSrinivas-C Posts: 4Questions: 1Answers: 0

    Hi kthorngren,

    Thanks for the response

    To brief the actual time taken for 50K data.. For rendering that data it is taking around 3seconds and for executing the datatable javascript function takes around 10seconds. So, some how can I reduce this 10seconds??

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    edited April 2021

    As that FAQ suggested, you could try serverSide,

    Colin

  • Srinivas-CSrinivas-C Posts: 4Questions: 1Answers: 0

    Hi Colin,

    After rendering the data in template I can use the serverSide option in datatable javascript function or don't need to render the data in template?

    Also, I tried giving '"orderClasses": false' parameter in function but no improve in performance..

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Hi,

    After rendering the data in template I can use the serverSide option in datatable javascript function or don't need to render the data in template?

    Sorry, I don't understand that. You can render client-side with columns.render when using serverSide - the server just sends the data, then the client can decide how to render it.

    Colin

  • Srinivas-CSrinivas-C Posts: 4Questions: 1Answers: 0

    Hi kthorngren, Colin,

    Thanks for the help..

    I went through the FAQ and also through the column.render option as mentioned above and now able to reduce the time for rendering from 15sec to 1.8sec...

    Thank you

This discussion has been closed.