Slow actions on big tables
Slow actions on big tables
ziv@kpmbro.com
Posts: 73Questions: 28Answers: 4
in General
Hi Allan.
Lately my MySQL tables got big and i noticed on my main table (table with a lot of Mjoin and left joins) when user try to do : edit/new/duplicate it take almost a minute of processing , when i try to debug it i saw that the datatable delete all the rows related to that row from all the Mjoin tables and then doing insert , how can i speed up the process ??
Thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It will delete and then insert all rows in the Mjoin'ed table rather than attempting to do a diff, which I think would probably be just as slow and add a huge amount of complexity to the code.
Are you using server-side processing? If not, that would be the first port of call.
Allan
Tnx Allan
yes im using the server-side processing, is there more ways to speed it up?
the delete/insert should not take all that time (1 min), i think its also the select after he finish update..
any ideas ?
Thanks
I agree - 1 minute is an exceptionally long time. I would suggest enabling the debug mode in the server-side libraries (
.Debug(true)
in .NET,->debug( true )
in PHP - I can't remember which one you are using I'm afraid).Then you will be able to see exactly what the queries are that Editor is running and be able to execute them against your database directly to see which one is taking a long time to run.
Thanks,
Allan
Hi Allan
I could not find that debug option but i did get the log out of my sql
here are the queries for update
the weird part is that there are 2 "waiting periods" one is in the bubble editor after i press update and the second is after the bubble editor is disappear when the table processing div is showing.
That's because server-side processing is being used. The first request is to update the data, and the second request will get the new data for DataTables (since every draw, when server-side processing is enabled, will make an Ajax request).
Which of the two is taking a long time?
Allan
Hi Allan
I think i found the issue, the Mjoin is doing the select on the one to many table with out the where.
it looks like this :
how can i add the where instance to the mjoin?
thanks
If you want to add a condition to the
Mjoin
you can use->where()
just like you would on the mainEditor
instance:Allan
That was it , cool thanks a lot