12

Possible Duplicate:
Disadvantages of MARS (Multiple Active Result Sets)?

I am developing an application such that i have to use multiple DataReaders at the same time. When i say Multiple datareaders i mean MULTIPLE DATAREADERS... there would be a few required at the same time.(something around 10-50 or more)

So one scenario that i came across was to use different connection strings.. but implementing that i feel awkward!!!

Another method is to use MARS which i found it was pretty decent. but my doubt is that do i need to consider or take any precautions when i implement it or is something vicious waiting for me to happen :-)

from my so called research what i was able to find was that by using MARS the server produces data fast, so the client app must receive the data at the same speed it comes in. else the data storage buffer will be filled leading to the processing to stop.. and will be enabled only when the buffer gets empty..

i got lost somewhere around here....

Also i am using only Select statements only for this reqiurement..

so my question is that are there any disadvantages using them?? how much of of data can be stored in the server data buffer such that the processing wouldn't stop??

4
  • 1
    What is your question? (Something that ends with a question mark, if that helps you put it into words) Commented Sep 5, 2011 at 12:30
  • Can you also quantify "MULTIPLE DATAREADERS". Putting it in capital letters doesn't make it a number.
    – Tony
    Commented Sep 5, 2011 at 12:33
  • @Johnstone => he he completely forgot to end it with a questions
    – Manek
    Commented Sep 5, 2011 at 12:37
  • @Tony => number i a cant say exactly it can go to something around 100 or something.
    – Manek
    Commented Sep 5, 2011 at 12:38

1 Answer 1

1

I suggest you use multiple connections, if it's really necessary to read from 100 datasets at once. I can't see why you'd need to have multiple active datareaders on a single connection.

It's more likely the query or task you are trying to achieve can be done without needing to do this large parallel operation, however. If you can be more specific with some details perhaps we can work out a good few alternative suggestions.

4
  • @Johnstone => i tried a lot to optimize at the query side and now i am moving on ahead with MARS. It is something like we get a list from one TableA and each row in TableA will fetch list from TableB and each row in TableB will have to fetch a list from TableC and so on. Phew!! i know that this sounds weird but anyways thanks a load for you time here. i just wanted to know about the data that could be stored in the data buffer..
    – Manek
    Commented Sep 6, 2011 at 5:26
  • 1
    That sounds exactly like what a join does. It's likely you can do what you want with a single query and it will be far, far faster than what you're doing. Commented Sep 6, 2011 at 6:28
  • For example: SELECT * FROM TblA INNER JOIN TblB ON X=Y gives all rows from TblA, and for each row in TblB where the criteria X=Y is met, a list of rows from TblB. Commented Sep 6, 2011 at 7:50
  • @KierenJohnstone: The way you described JOIN makes it sound like what UNION does. JOIN takes columns from multiple tables and creates new composite rows containing columns from multiple tables (based on match criteria). UNION is the one that returns individual rows from multiple tables. The purpose of JOIN is to add extra columns from other tables. The purpose of UNION is to return multiple result sets as one. I agree that JOIN is probably what OP needs to simplify the process. Sub-queries are another option.
    – Michael
    Commented Sep 27, 2016 at 9:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.