Dash app query from db takes to long! What can I do?

Hello community,

I thought I am nearly finished with my project but I have a really big issue. When I am executing my query to update my dataframe for the dash app it takes nearly 6 minutes and when I am using the same query in a db interface it is finished in 4 seconds. Why is the difference so big? When i cant find a solution for this i need to make a local db which updates every day from the actual db I am currently getting my datas.

Whats the best way to fill the local db with the data i need from the other db?

im using sqlalchemy and the server is an adaptive sql anywhere version 7

I Hope somebody can help me.

Thanks in advance.

Greeting Mae.