Hey guys, wanted to let you know about an issue I found with Prosper202 that has the potential to slow your reporting down if you are logging more than a couple thousand clicks a day. This fix can only help people running Prosper202 under Mysql 5.1+.
Here is the summary…
When they built the install code for the 202_CLICKS table they wrote in some code to setup data partitions within the table to segregate records based on timestamps into 2 week groups. (See prosperinstall/202-config/functions.php starting on line 275). This helps to speed up the SQL parser when running reports by day. The problem is they only broke out partitions through 1/11/2009 and everything recorded after that date goes into a catch all partition (p32). To fix this, I wrote some SQL code that will modify the table and break out the p32 (catch all) partition into a bunch more partitions. I choose to group the partitions into 5 day increments after Feb. 16th (the day I wrote the fix). This code should get you through Dec. 17th, 2009. After that you can just add more partitions if need be. MySql 5.1+ supports up to 1024 partitions on a table.
If you answer YES to all of the following, this should help speed things up for you.
1.I am running prosper202 with mysql 5.1+
2.When I run the sql query “[FONT="]EXPLAIN[/FONT][FONT="] PARTITIONS[/FONT][FONT="] SELECT[/FONT][FONT="] *[/FONT][FONT="] FROM[/FONT][FONT="] 202_CLICKS[/FONT]“ on my prosper database I see p0,p1,p2, etc. in the partition list (if you see NULL you have no partitions).
If both those apply do the following:
1.Backup your database.
2.Connect to your propser202 database using phpmyadmin or whatever your normal method is to issue sql commands.
3.Run the following command:
ALTER TABLE 202_clicks
REORGANIZE PARTITION p32 INTO (
PARTITION p32 VALUES LESS THAN (1232089200),
PARTITION p33 VALUES LESS THAN (1232521200),
PARTITION p34 VALUES LESS THAN (1232953200),
PARTITION p35 VALUES LESS THAN (1233385200),
PARTITION p36 VALUES LESS THAN (1233817200),
PARTITION p37 VALUES LESS THAN (1234249200),
PARTITION p38 VALUES LESS THAN (1234681200),
PARTITION p39 VALUES LESS THAN (1235113200),
PARTITION p40 VALUES LESS THAN (1235545200),
PARTITION p41 VALUES LESS THAN (1235977200),
PARTITION p42 VALUES LESS THAN (1236409200),
PARTITION p43 VALUES LESS THAN (1236841200),
PARTITION p44 VALUES LESS THAN (1237273200),
PARTITION p45 VALUES LESS THAN (1237705200),
PARTITION p46 VALUES LESS THAN (1238137200),
PARTITION p47 VALUES LESS THAN (1238569200),
PARTITION p48 VALUES LESS THAN (1239001200),
PARTITION p49 VALUES LESS THAN (1239433200),
PARTITION p50 VALUES LESS THAN (1239865200),
PARTITION p51 VALUES LESS THAN (1240297200),
PARTITION p52 VALUES LESS THAN (1240729200),
PARTITION p53 VALUES LESS THAN (1241161200),
PARTITION p54 VALUES LESS THAN (1241593200),
PARTITION p55 VALUES LESS THAN (1242025200),
PARTITION p56 VALUES LESS THAN (1242457200),
PARTITION p57 VALUES LESS THAN (1242889200),
PARTITION p58 VALUES LESS THAN (1243321200),
PARTITION p59 VALUES LESS THAN (1243753200),
PARTITION p60 VALUES LESS THAN (1244185200),
PARTITION p61 VALUES LESS THAN (1244617200),
PARTITION p62 VALUES LESS THAN (1245049200),
PARTITION p63 VALUES LESS THAN (1245481200),
PARTITION p64 VALUES LESS THAN (1245913200),
PARTITION p65 VALUES LESS THAN (1246345200),
PARTITION p66 VALUES LESS THAN (1246777200),
PARTITION p67 VALUES LESS THAN (1247209200),
PARTITION p68 VALUES LESS THAN (1247641200),
PARTITION p69 VALUES LESS THAN (1248073200),
PARTITION p70 VALUES LESS THAN (1248505200),
PARTITION p71 VALUES LESS THAN (1248937200),
PARTITION p72 VALUES LESS THAN (1249369200),
PARTITION p73 VALUES LESS THAN (1249801200),
PARTITION p74 VALUES LESS THAN (1250233200),
PARTITION p75 VALUES LESS THAN (1250665200),
PARTITION p76 VALUES LESS THAN (1251097200),
PARTITION p77 VALUES LESS THAN (1251529200),
PARTITION p78 VALUES LESS THAN (1251961200),
PARTITION p79 VALUES LESS THAN (1252393200),
PARTITION p80 VALUES LESS THAN (1252825200),
PARTITION p81 VALUES LESS THAN (1253257200),
PARTITION p82 VALUES LESS THAN (1253689200),
PARTITION p83 VALUES LESS THAN (1254121200),
PARTITION p84 VALUES LESS THAN (1254553200),
PARTITION p85 VALUES LESS THAN (1254985200),
PARTITION p86 VALUES LESS THAN (1255417200),
PARTITION p87 VALUES LESS THAN (1255849200),
PARTITION p88 VALUES LESS THAN (1256281200),
PARTITION p89 VALUES LESS THAN (1256713200),
PARTITION p90 VALUES LESS THAN (1257145200),
PARTITION p91 VALUES LESS THAN (1257577200),
PARTITION p92 VALUES LESS THAN (1258009200),
PARTITION p93 VALUES LESS THAN (1258441200),
PARTITION p94 VALUES LESS THAN (1258873200),
PARTITION p95 VALUES LESS THAN (1259305200),
PARTITION p96 VALUES LESS THAN (1259737200),
PARTITION p97 VALUES LESS THAN (1260169200),
PARTITION p98 VALUES LESS THAN (1260601200),
PARTITION p99 VALUES LESS THAN (1261033200),
PARTITION p500 VALUES LESS THAN MAXVALUE
);
Please, please, please don’t do anything if you don’t understand what I am talking about. This has helped speed up my daily reporting by a noticeable amount. Post here if you have any questions or need help so I can answer to help everyone. Feel free to repost or whatever.
DISCLAIMER – I am no DBA and am not liable… blah blah blah…..
Good Luck!
PS - I love prosper202 and am interested in doing more to keep this free version alive and working well. If anyone is interested in starting a place to modify, add on to, and support this version, PM and lets talk about it.
Here is the summary…
When they built the install code for the 202_CLICKS table they wrote in some code to setup data partitions within the table to segregate records based on timestamps into 2 week groups. (See prosperinstall/202-config/functions.php starting on line 275). This helps to speed up the SQL parser when running reports by day. The problem is they only broke out partitions through 1/11/2009 and everything recorded after that date goes into a catch all partition (p32). To fix this, I wrote some SQL code that will modify the table and break out the p32 (catch all) partition into a bunch more partitions. I choose to group the partitions into 5 day increments after Feb. 16th (the day I wrote the fix). This code should get you through Dec. 17th, 2009. After that you can just add more partitions if need be. MySql 5.1+ supports up to 1024 partitions on a table.
If you answer YES to all of the following, this should help speed things up for you.
1.I am running prosper202 with mysql 5.1+
2.When I run the sql query “[FONT="]EXPLAIN[/FONT][FONT="] PARTITIONS[/FONT][FONT="] SELECT[/FONT][FONT="] *[/FONT][FONT="] FROM[/FONT][FONT="] 202_CLICKS[/FONT]“ on my prosper database I see p0,p1,p2, etc. in the partition list (if you see NULL you have no partitions).
If both those apply do the following:
1.Backup your database.
2.Connect to your propser202 database using phpmyadmin or whatever your normal method is to issue sql commands.
3.Run the following command:
ALTER TABLE 202_clicks
REORGANIZE PARTITION p32 INTO (
PARTITION p32 VALUES LESS THAN (1232089200),
PARTITION p33 VALUES LESS THAN (1232521200),
PARTITION p34 VALUES LESS THAN (1232953200),
PARTITION p35 VALUES LESS THAN (1233385200),
PARTITION p36 VALUES LESS THAN (1233817200),
PARTITION p37 VALUES LESS THAN (1234249200),
PARTITION p38 VALUES LESS THAN (1234681200),
PARTITION p39 VALUES LESS THAN (1235113200),
PARTITION p40 VALUES LESS THAN (1235545200),
PARTITION p41 VALUES LESS THAN (1235977200),
PARTITION p42 VALUES LESS THAN (1236409200),
PARTITION p43 VALUES LESS THAN (1236841200),
PARTITION p44 VALUES LESS THAN (1237273200),
PARTITION p45 VALUES LESS THAN (1237705200),
PARTITION p46 VALUES LESS THAN (1238137200),
PARTITION p47 VALUES LESS THAN (1238569200),
PARTITION p48 VALUES LESS THAN (1239001200),
PARTITION p49 VALUES LESS THAN (1239433200),
PARTITION p50 VALUES LESS THAN (1239865200),
PARTITION p51 VALUES LESS THAN (1240297200),
PARTITION p52 VALUES LESS THAN (1240729200),
PARTITION p53 VALUES LESS THAN (1241161200),
PARTITION p54 VALUES LESS THAN (1241593200),
PARTITION p55 VALUES LESS THAN (1242025200),
PARTITION p56 VALUES LESS THAN (1242457200),
PARTITION p57 VALUES LESS THAN (1242889200),
PARTITION p58 VALUES LESS THAN (1243321200),
PARTITION p59 VALUES LESS THAN (1243753200),
PARTITION p60 VALUES LESS THAN (1244185200),
PARTITION p61 VALUES LESS THAN (1244617200),
PARTITION p62 VALUES LESS THAN (1245049200),
PARTITION p63 VALUES LESS THAN (1245481200),
PARTITION p64 VALUES LESS THAN (1245913200),
PARTITION p65 VALUES LESS THAN (1246345200),
PARTITION p66 VALUES LESS THAN (1246777200),
PARTITION p67 VALUES LESS THAN (1247209200),
PARTITION p68 VALUES LESS THAN (1247641200),
PARTITION p69 VALUES LESS THAN (1248073200),
PARTITION p70 VALUES LESS THAN (1248505200),
PARTITION p71 VALUES LESS THAN (1248937200),
PARTITION p72 VALUES LESS THAN (1249369200),
PARTITION p73 VALUES LESS THAN (1249801200),
PARTITION p74 VALUES LESS THAN (1250233200),
PARTITION p75 VALUES LESS THAN (1250665200),
PARTITION p76 VALUES LESS THAN (1251097200),
PARTITION p77 VALUES LESS THAN (1251529200),
PARTITION p78 VALUES LESS THAN (1251961200),
PARTITION p79 VALUES LESS THAN (1252393200),
PARTITION p80 VALUES LESS THAN (1252825200),
PARTITION p81 VALUES LESS THAN (1253257200),
PARTITION p82 VALUES LESS THAN (1253689200),
PARTITION p83 VALUES LESS THAN (1254121200),
PARTITION p84 VALUES LESS THAN (1254553200),
PARTITION p85 VALUES LESS THAN (1254985200),
PARTITION p86 VALUES LESS THAN (1255417200),
PARTITION p87 VALUES LESS THAN (1255849200),
PARTITION p88 VALUES LESS THAN (1256281200),
PARTITION p89 VALUES LESS THAN (1256713200),
PARTITION p90 VALUES LESS THAN (1257145200),
PARTITION p91 VALUES LESS THAN (1257577200),
PARTITION p92 VALUES LESS THAN (1258009200),
PARTITION p93 VALUES LESS THAN (1258441200),
PARTITION p94 VALUES LESS THAN (1258873200),
PARTITION p95 VALUES LESS THAN (1259305200),
PARTITION p96 VALUES LESS THAN (1259737200),
PARTITION p97 VALUES LESS THAN (1260169200),
PARTITION p98 VALUES LESS THAN (1260601200),
PARTITION p99 VALUES LESS THAN (1261033200),
PARTITION p500 VALUES LESS THAN MAXVALUE
);
Please, please, please don’t do anything if you don’t understand what I am talking about. This has helped speed up my daily reporting by a noticeable amount. Post here if you have any questions or need help so I can answer to help everyone. Feel free to repost or whatever.
DISCLAIMER – I am no DBA and am not liable… blah blah blah…..
Good Luck!
PS - I love prosper202 and am interested in doing more to keep this free version alive and working well. If anyone is interested in starting a place to modify, add on to, and support this version, PM and lets talk about it.