Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ

Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ

Scheduled Pinned Locked Moved ASP.NET
questioncsharplinq
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lyubomir Rumenov Velchev
    wrote on last edited by
    #1

    Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ. What is the difference if is working with milions of records in a table? Thanks for your answers!

    E E N 3 Replies Last reply
    0
    • L Lyubomir Rumenov Velchev

      Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ. What is the difference if is working with milions of records in a table? Thanks for your answers!

      E Offline
      E Offline
      elizas
      wrote on last edited by
      #2

      Hi, Though I am not a technical person but found your post to be very informative. I would like to share a link where a Software Testing Engineer of my company (http://mindfiresolutions.com/[^]Mindfire Solutions) has done a very good analysis on http://mindfiresolutions.com/database-and-client-server-development.htm[^]database application. Hope you find it useful.

      Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.

      1 Reply Last reply
      0
      • L Lyubomir Rumenov Velchev

        Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ. What is the difference if is working with milions of records in a table? Thanks for your answers!

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #3

        A properly used data reader will always be faster ... since it is of course the most direct method of accessing data in .NET. Data readers are even more efficient if you define indexes for the returned columns instead of using the string look-up method.

        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

        L 1 Reply Last reply
        0
        • E Ennis Ray Lynch Jr

          A properly used data reader will always be faster ... since it is of course the most direct method of accessing data in .NET. Data readers are even more efficient if you define indexes for the returned columns instead of using the string look-up method.

          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

          L Offline
          L Offline
          Lyubomir Rumenov Velchev
          wrote on last edited by
          #4

          Do you how much faster it will be? Do you have any statistics for example table with 10 milin rows?

          E 1 Reply Last reply
          0
          • L Lyubomir Rumenov Velchev

            Do you how much faster it will be? Do you have any statistics for example table with 10 milin rows?

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #5

            I have a system which I currently maintain that I converted one report from LINQ to the Data reader method. The one report was estimated to have a run time of a week with LINQ (we never let it finish just did timings on subsets) and the data reader version takes 30 seconds. Admittedly the LINQ version could have been cleaned up but LINQ encourages bad code so that needs to be watched for as well. In general Data Readers with integer column indexes on well written stored procedures: fastest Data Readers with string column indexes on well written stored procedures: 10x slower LINQ 20x to 100x slower. Some situations LINQ will be just as fast as data readers but never faster. You can ignore the size of the database for the discussion. If you want statistics there is someone who did a nice little timing comparison between all of the methods (you can search Google if you want) or you can take my word for it.

            Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

            M 1 Reply Last reply
            0
            • L Lyubomir Rumenov Velchev

              Wich dataaccess metod is faster - with datareader when the data is return from stored procedures or with LINQ. What is the difference if is working with milions of records in a table? Thanks for your answers!

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Look here[^]


              I know the language. I've read a book. - _Madmatt

              1 Reply Last reply
              0
              • E Ennis Ray Lynch Jr

                I have a system which I currently maintain that I converted one report from LINQ to the Data reader method. The one report was estimated to have a run time of a week with LINQ (we never let it finish just did timings on subsets) and the data reader version takes 30 seconds. Admittedly the LINQ version could have been cleaned up but LINQ encourages bad code so that needs to be watched for as well. In general Data Readers with integer column indexes on well written stored procedures: fastest Data Readers with string column indexes on well written stored procedures: 10x slower LINQ 20x to 100x slower. Some situations LINQ will be just as fast as data readers but never faster. You can ignore the size of the database for the discussion. If you want statistics there is someone who did a nice little timing comparison between all of the methods (you can search Google if you want) or you can take my word for it.

                Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                Ennis Ray Lynch, Jr. wrote:

                The one report was estimated to have a run time of a week with LINQ

                That is possibly a little unfair, I've had 1st draft stored procs that have run times of hours, after a little works and some indexing they get reduced to seconds. However your point that LINQ encourages lousy code by abstracting another layer is the telling point. How many devs get under the hood of the Linq, or are even capable of doing so! I'm of the opinion that LINQ is one of the greatest abominations ever to come out of MS.

                Never underestimate the power of human stupidity RAH

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups