Performance Improvement and sync for callbacks

Hi everyone,

I am trying to maintain a live graph based data pulled using sql queries. At the same time, I would like to maintain a table with the information the graph is based on right below it. Ideally, I am trying to keep the table sortable and filterable

I have the following issues:

  • I am not sure how to initially display a plot that gets overwritten right after by a newly generated one from a callback that used dcc.Interval.

  • The dataset is very large and the sql query takes about 12 seconds. I want to update both the plot and the table at the same time but my program runs quite slowly.

May I please have any suggestions on how to tackle these issues? Is there any way to display just the top of my table (based on the chosen sorting) while the rest is not loaded, for time efficiency?

What other performance efficiencies would I be able to add?

Thank you in advance for any help.

I’m not sure what you mean by this – you can put in an empty dcc.Graph component into your layout that serves as a sort of “placeholder”. You’d define an id for it, then in the callback with your interval, you would update the layout/data of that graph using its id.

You could look into pagination here: Python-Driven Filtering, Paging, Sorting | Dash for Python Documentation | Plotly

I don’t know how to help with this one unfortunately! You could look into wrapping the graph/table with a dcc.Loading component that will allow you to display a loading icon while the query is being completed.

Hope that helps a little!