Linq to SQL Caching

I need to present some summary data and was wondering how best to approach this with regard to speed and memory usage (I'm using Windows Phone)  

You will see from the queries below that they are all pretty much a variation on a theme.  I'm just wondering if there is a better way to return these results?

Thanks

            ' Base Query
            Dim rounddata = From rp In dc.RoundProps
                        Join pl In dc.Places
                        On rp.PropId Equals pl.UPRN
                        Where rp.RoundId.Equals(cRoundid)
                        Select pl

                ' Summarys
                Dim roundTotal = (From r In rounddata).Count
                Dim roundComplete = (From r In rounddata Where r.CompleteDate IsNot Nothing).Count
                Dim streetsTotal = (From r In rounddata Select r.StreetName).Distinct.Count
                Dim streetsToComplete = (From r In rounddata Where r.CompleteDate Is Nothing Select r.StreetName).Distinct.Count
                Dim streetTotal = (From r In rounddata Where r.USRN.Equals(cUsrn) Select r.StreetName).Distinct.Count
                Dim streetComplete = (From r In rounddata Where r.USRN.Equals(cUsrn) And r.CompleteDate IsNot Nothing).Count

                Dim agate = (From r In rounddata Where r.USRN.Equals(cUsrn) And r.CompleteDate Is Nothing And r.Notification.Equals("G")).Count
                Dim abag = (From r In rounddata Where r.USRN.Equals(cUsrn) And r.CompleteDate Is Nothing And r.Notification.Equals("B")).Count
                Dim afull = (From r In rounddata Where r.USRN.Equals(cUsrn) And r.CompleteDate Is Nothing And r.Notification.Equals("F")).Count
                Dim acom = (From r In rounddata Where r.USRN.Equals(cUsrn) And r.CompleteDate Is Nothing And r.Notification.Equals("C")).Count
                

Open in new window

WatersideAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
If all you need is the Summaries data, why don't you ask for it straight from the server?
Doing this directly on the DB Server will be much faster both calculating and transferring the results.

AS a rule of thumb, dumping all data on the client to then perform the counts and aggregations is always a bad idea. Considering that this will be used in mobile phones only makes it worse due to it's limited connectivity, memory, processing power... you name it.

How many records are being loaded from the server?
WatersideAuthor Commented:
There is no server.  The data is on the phone.
Alexandre SimõesManager / Technology SpecialistCommented:
Ok, so you're just executing 10 queries against the local DB.
I see no problem with that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WatersideAuthor Commented:
There are no problems as such.  I was looking for some insight into caching to improve it.
Alexandre SimõesManager / Technology SpecialistCommented:
Caching is an additional level of complexity that should only be used if necessary.

How many rows are we speaking about here?
How much time does it take to perform those queries (on the slowest device)?
How often is this information displayed?
How often does this base data change (invalidating the cache)?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.