Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7737451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:00:03+00:00 2026-06-01T08:00:03+00:00

Is this: Dim mydata = (From c In dc.Table Select New With {c.ID}).Count any

  • 0

Is this:

Dim mydata = (From c In dc.Table Select New With {c.ID}).Count

any faster than this:

Dim mydata = (From c In dc.Table Select c).Count

assuming the table has a good number of fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:00:05+00:00Added an answer on June 1, 2026 at 8:00 am

    The short answer: no.

    The SQL generated by the LINQ-to-SQL engine should be essentially the same for both forms (if not exactly the same) because you’re calling .Count() immediately on the query.

    A compiled query version, on the other hand, would be faster after the first execution. Here’s one way to do a compiled query for this:

    Public Shared FetchCount As Func(Of DataContext, Integer) = _
        CompiledQuery.Compile(Function(context as DataContext) _
            (From c in context.Table Select c).Count())
    

    DataContext would need to be the Type of the LINQ-to-SQL DBML, and Table would need to be the appropriate table. And, I believe you’ll need to import System.Data.Linq to have access to CompiledQuery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if i define a table like this: Dim datatable As PdfPTable = New PdfPTable(4)
When I execute this query: Dim Var Var = ("select max(Autonumber) from tblAutonumber") DoCmd.RunSQL
I have a list like this Dim emailList as new List(Of String) emailList.Add(one@domain.com) emailList.Add(two@domain.com)
I'm new to C#. I know in vb.net, i can do this: Dim guid
I'm using this code: Dim cListItems As New System.Collections.Generic.List(Of Combobox_values) cListItems.Add(New Combobox_values(One, 1)) cListItems.Add(New
What's the difference between reading a value from an SqlDataReader using this syntax: Dim
What I have right now is this: Dim users = From users In tempTable
I can do this: Dim fso As New FileSystemObject or I can do this:
I can create a new object like this: Dim sqlconn As New SqlClient.SqlConnection(cs) or
Let's say I got a table like this: data <- c(1,2,3,6,5,6,9,LC,LC,HC,HC,LC,HC,ALL) attr(data,dim) <- c(7,2)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.