How can I speed up writing on DB with toggle buttons?

Using toggle buttons to update the database is painfully slow.
It takes up to 5 secs to update/refresh the toggle button after clicking the button. This hurts the user experience a lot.

Does anyone know how to speed up?

Is there any forthcoming update to speed up the process?