dbTalk Databases Forums  

Great success creating a poor man's "materialized view"

comp.databases.mysql comp.databases.mysql


Discuss Great success creating a poor man's "materialized view" in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ignoramus6900
 
Posts: n/a

Default Great success creating a poor man's "materialized view" - 09-13-2011 , 07:57 AM






I have a website algebra.com, where volunteers answer students'
questions for free.

It has three tables relevant to discussion, such as

- questions
- answers
- users

To produce web archives of old answered questions, I had to join all
three tables. The pages present subsets of archives by category, split
to about 50 answers per webpage (using "LIMIT start, count" notation).

This resulted in a huge amount of relatively expensive JOIN queries
(taking 0.5 seconds each on a 4 year old server). MySQL load average was
about 150%.

I created a poor man's "materialized view" table, that is the required
join. I update it every time a new answer is added, however, I do not
update it when less important information changes, such as tutor score
values.

Additionally, I fully rebuild this materialized view every hour from
crontab and sort it properly right then.

The result is really, great, queries now take 0.15 seconds each and
MySQL CPU load average dropped to about 15% (about 10 times or so, not
sure exactly, but many times).

i

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.