Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...What is the best performing DAL design for filling multiple tables? Datasets, DNN?What is the best performing DAL design for filling multiple tables? Datasets, DNN?
Previous
 
Next
New Post
8/14/2008 4:13 AM
 

Hi,

I was wondering what would lead to the best performance for the next situation. I have a product table and a product variants table. So T-shirt with sizes X, XL, M, S. I would like to show all these products including their sizes in a grid so visitors can see what products and sizes are in stock. I am wondering what is the best way of collecting this data from the database? I assume I have 100 products and every product 4 variants. So 400 dataitems in total.

I have a productcontroller() and a productvariantscontroller()

1. Using DAL of DNN. So I call productcontroller() to get products and then on the databind I do a get to collect with the productvariantscontroller() for each product the variants. So I do: 1 fill with 100 returning products and 400 calls to fill these 100 returning products.: 1 + 400 = 401 database calls.

2. I am using dataset: I call 2 times the database: 1 to fill products and 1 to fill productvariants: so 2 database calls.

3. I can also create a class with has product + variants information in it and with a table join on the database I collect this information. However, the product information id redundant.. but that would be option 3.

In my opinion 2 is fastest, or does it not matter? Or is there a way to bind relationships with the DAL of DNN?

Any help from some application architects would be great!

J.

 
New Post
8/14/2008 10:24 AM
 

Personally, in my experience options 1 and 3 are the fastest.

Yes, DataSets are great, but you have a few issues.

1.) Everything is stored in memory, if you have multiple requests, this can add up quickly
2.) Every individual element would require a lookup and filter inside the DS to get the needed values
 

I have applications here at work, that have to do a similar process, in some reports we have results that actually execute 2002 queries, these pages load in under 1.2 seconds.  When using the DS, we would spike memory, and get the page in about 8 seconds.  That was our experience anyway.

It really depends on your data, but typically option 1 works better in the end, again at least in my experience.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
8/14/2008 11:58 AM
 

J.

In general a datareader should be faster than a dataset, regardless of how you implement it.  Yes, the datareader can contain only one result set but since I don't know how you present the data I don't know if it can be accommodated.  Maybe you can create a view in the database with the consolidated query you need and then populate your grid from the view instead of the tables directly.  In this way the relationship business is done at the database but again, I don't know if it applies to the way you are doing things.

Also, if you are doing paging with the grid, you should consider optimizing the paging so that you don't retrieve all the records every time.  There are many papers on how to do this.

And by the way, I am not too fond of the DNN DAL, too much work, and it may make some of the ideas above harder to implement.

Carlos

 

 
New Post
8/14/2008 1:28 PM
 

Actually a DataReader can return two sets of Data.

So in your example you can do the following in your Stored Procedure.

Select * from Products

Select * From ProductVariants

 

In your Controller you would do something like this - Syntax checking is not included in this editor so excus mistakes.

Dim reader as IDataReader = Dataprovider.Instance.GetProductsWithVariants()

While reader.Read()
   'Insert logic here that fills the Products
End While

If reader.NextResult() Then
  While reader.Read()
    'Insert logic here that fillls the product Variants
  End While
End If

OR

You could do the JOIN and return one data reader, make the Variants a child collection of the object and create a custom hydration routine that processes the data appropriately. The details of this is beyond the scope of a forum response.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
9/13/2008 3:38 PM
 

Hi,

Can I conclude that the DNN DAL is faster with datareader then the dataset of Microsoft?

I am interest to know how the relationship of Charles' approach is being created? The disadvantage of this JOIN query is that the product data is added to the data output of the database towards the web server. The amount of data is quite a bit.

What about collecting with a datareader first the product data and then in a cached datagrid collect on the databinding the variants one by one? Or is this a database killer? I am afraid too many database calls care much heavier than a single call. But how to combine with a relationship the products and variants of 2 data readers and the DNN dal. I normally love to connect every with JOINS but that makes you have to create custom dals since I fully generate the DAL of DNN with code smith template from a single table.

Any ideas if a relationship can be make on DNN dal objects?

J.

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...What is the best performing DAL design for filling multiple tables? Datasets, DNN?What is the best performing DAL design for filling multiple tables? Datasets, DNN?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out