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 8407633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:25:12+00:00 2026-06-09T23:25:12+00:00

I was wondering what would be a faster way as far as counting rows

  • 0

I was wondering what would be a faster way as far as counting rows is concerned from a database? Is count query in DB (server) going to be faster than some sort of count in a program (client).
I think the things that are to be considered are

  • Size of the database

  • Programing language use

  • Are the rows that are to be counted required by the client?

Any suggestions?

  • 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-09T23:25:13+00:00Added an answer on June 9, 2026 at 11:25 pm

    Just the counting by itself cannot be made any faster than executing it in a compiled language like C++, C# or Java. Counting through a stream of rows is nothing.

    Unfortunately, copying the rows from the server to the client is enormously more expensive that counting them. So you are always better off letting the server count them.

    I literally cannot think of a scenario in which one should count on the client (if the only thing required is the count, not the rows themselves).

    If the rows are required on the client:

    1. If all rows are required: Count on the client
    2. If only a single page is required: Count on the server! There might be hundreds or thousands of pages and you don’t want to download all of them. The RDBMS can often optimize counting because no column data is required to count.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering which way would end up being faster, selecting elements by: $('element[href=#my_link]');
i was wondering what would be the best way to code a browser plugin
i was wondering - what's the fastest way to mail out from asp: i'm
Just wondering if there is a faster way to split a file into N
I was wondering if InnoDB would be the best way to format the table?
I'm wondering if there is a faster method than using something like: while (Reader.Read())
Just wondering, if there is something better, newer, safer, faster, etc than Runtime.getRuntime().exec() .
Im just wondering what would the best way to display multiple instances of a
I was wondering what is the better/faster way to resize an image. Normally I
I was wondering would I still need to use a basic game loop for

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.