I have two tables containing data that are essentially headline lists from different sources. This is being done in MVC 3 (EF available) with SQL Server 2005.
Table 1: date – title – id
Table 2: date – title – id
What I would like to try to do is combine these into a single master list that can be
- Paginated for browsing
- Supports date based ranges for querying which can then be browsed.
Currently the paginating is difficult as the number of articles from each source in any set of X is varied by the update frequency of that source.
If this possible to do with a View or using Union All? There are about 300,000 rows covering about 15 years worth of headlines. Is there a better way I am missing?
I haven’t tried this but combining a union with skip and take should work.
MSDN has an example of the union, http://msdn.microsoft.com/en-us/library/bb896299.aspx, I guess you’ll want apply your date range filter to each part.
There’s a SO answer here SQL Table Paging PERFORMANCE …is EF4 + Linq SKIP +TAKE equal in performance than using TSQL params to request "paging" on a SQL Table? that talks about skip and take as well as the performance.
You could probably make things easier for your self by combining the data from tables 1&2 into one with a source field if you like.