vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am creating a vb.net app that stores its data in mysql. There are several lists of data that users access in drop down boxes and such. The data does not change very much in the db. I was thinking that when I needed to show one of these lists, I could check if there have been any changes in the db first, if not I can just use the in-memory data, saving the bandwidth of having to pull back an entire table. If there has been a change, I can refresh the data with a call to the db. pseudo code: x = md5( in-memory list ) con.open y = SELECT md5( sum of all rows in table ) FROM table; con.close if x = y then 'check sums are equal, no data changed, return in-memory data else 'check sums are different, a change has been made, get new data from table con.open dataset = SELECT * FROM table; end if |
| ||||
| Bryan wrote: > I am creating a vb.net app that stores its data in mysql. There are > several lists of data that users access in drop down boxes and such. > The data does not change very much in the db. I was thinking that > when I needed to show one of these lists, I could check if there have > been any changes in the db first, if not I can just use the in-memory > data, saving the bandwidth of having to pull back an entire table. If > there has been a change, I can refresh the data with a call to the db. > > pseudo code: > x = md5( in-memory list ) > > con.open > y = SELECT md5( sum of all rows in table ) FROM table; > con.close > > if x = y then > 'check sums are equal, no data changed, return in-memory data > else > 'check sums are different, a change has been made, get new data > from table > con.open > dataset = SELECT * FROM table; > > end if > You might as well just fetch the list. You still need to fetch all the rows - but instead of returning them you're taking the md5 of them. You're cutting down the network traffic but increasing the load on the server. But of course, since you're using VB.NET you may need to do that. And you're needlessly complicating your code. KISS, and if you have a problem later you can address it. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |