Hi there,
i am trying to learn c#.net to program a web app.
And having learned that stackoverflow uses C#.net I am happy to discover it.
I noticed that at the home page or at the questions section, whenever i refresh the page. The page always returns me the latest information without fail and at acceptable speeds.
I am not sure how do you do it. Sorry for the long series of questions. I am trying to learn what is the best practices for data retrieval, paging, performance , etc
I know that the homepage only returns a limited number of questions and their stats but the questions section actually returns everything.
How do you optimise it?
1) For the homepage, do you always grab ALL the stats of the recent questions? so your query is something like "select * from questions order by datetime_created limit 20" ?
so the * contains ALL the info including question title, id, views, etc?
Do you use HttpContext.Current.Server.cache to help with that?
2) For the questions, this is even more intriguing.
how do you do the paging?
Do you always grab from the database only the results for the specific page?
or do you grab all the results and store it into a dataset? Then you use some kind of datagrid control to help with the paging?
If it is the latter, how do you maintain the data to be updated?
Thank you.