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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:43:52+00:00 2026-05-15T22:43:52+00:00

I have a file that goes thru a large data set and splits out

  • 0

I have a file that goes thru a large data set and splits out the rows in a paginated manner. The dataset contains about 210k rows, which isn’t even that much, it will grow to 3Mil+ in a few weeks, but its already slow.

I have a first query that gets the total number of items in the DB for a particular WHERE clause combination, the most basic one looks like this:

SELECT count(v_id) as num_items FROM versions 
WHERE v_status = 1

It takes 0.9 seconds to run.

The 2nd query is a LIMIT query that gets the actual data for that page. This query is really quick. (less than 0.001 s).

SELECT 
        v_id, 
        v_title,
        v_desc
    FROM versions 
    WHERE v_status = 1 
    ORDER BY  v_dateadded DESC 
    LIMIT 0, 25

There is an index on v_status, v_dateadded

I use php. I cache the result into memcace, so subsequent requests are really fast, but the first request is laggy. Especially once I throw in a fulltext search in there, it starts taking 2-3 seconds for the 2 queries.

  • 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-05-15T22:43:53+00:00Added an answer on May 15, 2026 at 10:43 pm

    I don’t think this is right, but try making it count(*), i think the count(x) has to go through every row and count only the ones that don’t have a null value (so it has to go through all the rows)

    Given that v_id is a PRIMARY KEY it should not have any nulls, so try count(*) instead…

    But i don’t think it will help since you have a where clause.

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

Sidebar

Related Questions

Suppose I have a bash script that goes through a file that contains a
I have pretty simple problem. I have a large file that goes through three
I have a CSV file that goes something like this: ['Name1', '', '', '',
I now have a file uploader that goes on like this This is the
I have a File that COntains Strings in This Format: ACHMU)][2:s,161,(ACH Payment Sys Menus
I have a file that contains this <!-- CordovaVersion --> I want to replace
I have an XML document and a CSS file that goes with it, which
lets say i have an xml file path.xml that goes like this: <paths> <path
Hey there. Basically, I have a batch-file, that goes through all model and texture
I have a .txt file that has the following details: ID^NAME^DESCRIPTION^IMAGES 123^test^Some text goes

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.