1

I have a mysql query that is taking 8 seconds to execute/fetch (in workbench).

I won't go into the details of why it may be slow (I think GROUPBY isnt helping though).

What I really want to know is, how I can basically cache it to work more quickly because the tables only change like 5-10 times/hr, while users access the site 1000s times/hour.

Is there a way to just have the results regenerated/cached when the db changes so results are not constantly regenerated?

I'm quite new to sql so any basic thought may go a long way.

4

2 に答える 2

0

長時間実行されるクエリの応答時間を短縮するために使用できる簡単なソリューションは、基になるデータの更新またはビジネス ニーズに基づいて、定期的に集計テーブルを生成することです。

たとえば、ビジネスで 1 分未満の「精度」を気にしない場合は、生データをオンラインで要約する代わりに、プロセスを 1 分ごとに実行し、この計算テーブルをクエリするようにユーザー インターフェイスを作成できます。

于 2013-07-09T13:39:23.837 に答える