2. Moving to more materialized views and prepared statements where we can.

Definitely worth investigating. I wish I could, but I can't get my customers to even consider slightly out of date stats.... :(

Put a button 'Stats updated every hour', which gives the results in 0.1 seconds, and a button 'stats in real time' which crunches 10 seconds before displaying the page... if 90% of the people click on the first one you save a lot of CPU.

Seems like people who hit Refresh every 10 seconds to see an earnings graph creep up by half a pixel every time... but it seems it's moving !

More seriously, you can update your stats in near real time with a materialized view, there are two ways :
- ON INSERT / ON UPDATE triggers which update the stats in real time based on each modification
- Have statistics computed for everything until some point in time (like an hour ago) and only compute and add stats on the records added or modified since (but it does not work very well for deleted records...)

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Reply via email to