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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:30:01+00:00 2026-06-12T05:30:01+00:00

I am currently doing the following join and it takes a very long time

  • 0

I am currently doing the following join and it takes a very long time to execute the query, is there a way to make it run quicker?
I have 23 fields in the table. I have a primary key on the field ‘id’ (int) 5
reg (varchar) 9

SELECT a1.*, ( SELECT COUNT(reg) FROM auction a2 WHERE reg = a1.reg) AS c1 FROM auction a1


CREATE TABLE IF NOT EXISTS `db1` (
  `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  `adate` varchar(10) NOT NULL,
  `lnu` int(4) NOT NULL,
  `reg` varchar(9) NOT NULL,
  `mk` varchar(50) NOT NULL,
  `mod` varchar(50) NOT NULL,
  `type` varchar(25) NOT NULL,
  `ree` varchar(50) NOT NULL,
  `co` varchar(50) NOT NULL,
  `fu` varchar(20) NOT NULL,
  `tran` varchar(20) NOT NULL,
  `mt` varchar(9) NOT NULL,
  `mile` int(6) NOT NULL,
  `ree` int(6) NOT NULL,
  `apv` int(6) NOT NULL,
  `ds` int(2) NOT NULL,
  `sr` varchar(50) NOT NULL,
  `sen` int(10) NOT NULL,
  `keep` int(2) unsigned NOT NULL,
  `tmp` char(1) DEFAULT NULL,
  `rk` varchar(100) DEFAULT NULL,
  `st` varchar(3) DEFAULT NULL,
  `dd` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `date` (`adate`)
  • 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-12T05:30:02+00:00Added an answer on June 12, 2026 at 5:30 am

    Seeing fromyour current schema, you should have provided index on reg column.

    SELECT a1.*, a2.totalCount
    FROM    auction a1
            INNER JOIN 
            (
                SELECT reg, COUNT(*)  totalCount
                FROM auction a2
                GROUP BY reg
            ) a2 
                ON a2.reg = a1.reg
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am doing mass deletes using variations of the following query: DELETE FROM
I'm currently doing the following to compensate for boolean's not mapping well to radio
I'm currently doing the following as part of my iPhone application NSArray *paths =
I currently need to execute a database query that involves data from three separate
I'm currently doing the following to use typed datasets in vs2008: Right click on
I'm currently doing some tests and I noticed the following: select field1 from table1
I have the following join statement: var query = from holding in dHoldList join
Im currently doing a console app that has to send scheduled emails. In one
I'm currently doing facebook integration and have gone through this tutorial . So far,
I am currently doing a project in which I have to request data from

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.