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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:25:32+00:00 2026-05-12T09:25:32+00:00

I have a table with 8 million records that looks like this: CREATE TABLE

  • 0

I have a table with 8 million records that looks like this:

CREATE TABLE `bdp_dosis` (
  `ID_INSTITUTION` varchar(4) NOT NULL default '',
  `ID_SERVICE` char(2) NOT NULL default '',
  `SECUENCIAL` char(3) NOT NULL default '',
  `TYPE` char(1) NOT NULL default '',
  `DATE_LECTURA` varchar(8) NOT NULL default '',
  `ID_TARJETA` varchar(9) default NULL,
  `DATE_ASIGNACION` varchar(8) NOT NULL default '',
  `DOSIS_1` int(11) default NULL,
  `DOSIS_2` int(11) default NULL,
  `COMMENT` char(1) NOT NULL default '',
  `CATEGORIA` char(2) default NULL,
  `TYPE_TRABAJO` char(2) default NULL,
  PRIMARY KEY  (`ID_INSTITUTION`, `ID_SERVICE`,`SECUENCIAL`, `TYPE`, `DATE_LECTURA`, `DATE_ASIGNACION`, `COMMENT`)) ENGINE=MyISAM

The design of the table can’t be changed but some indexes will make it perform less bad with this query:

select d.ID_SERVICE,d.SECUENCIAL,d.TYPE,d.DATE_LECTURA,d.DATE_ASIGNACION,d.DOSIS_1,d.DOSIS_2,d.COMCOMMENT
from bdp_dosis d
where d.ID_INSTITUTION='46C7'
and d.DATE_asignacion>'20080100'
and d.DATE_asignacion<'20081232' and locate(d.COMMENT,'WQ')<>0
order by d.ID_SERVICE,d.SECUENCIAL,d.TYPE,d.fecha_lectura desc

The EXPLAIN command says:

id  select_type  table  type  possible_keys  key      key_len  ref    
1   SIMPLE       d      ref   PRIMARY        PRIMARY  4        const  
rows    Extra
254269  Using where; Using filesort

I tried to put an index at ID_INSTITUTION-ID_SERVICE with no big results. Any idea?

  • 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-12T09:25:32+00:00Added an answer on May 12, 2026 at 9:25 am

    A key on ID_INSTITUTION and DATE_asignacion is more likely to help.

    If that still doesn’t get you very far, you might want to look into going to mysql 5.1 and using partitioning.

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

Sidebar

Related Questions

I have a table that has 8 million records, with many fields, including lat/long
I have a table that has about 1/2 million records in it. Each month
I have a table storing millions of rows. It looks something like this: Table_Docs
We have the following table: CREATE TABLE [dbo].[CampaignCustomer]( [ID] [int] IDENTITY(1,1) NOT NULL, [CampaignID]
We have the following table: CREATE TABLE [dbo].[CampaignCustomer]( [ID] [int] IDENTITY(1,1) NOT NULL, [CampaignID]
I have a large table with 1 million+ records. Unfortunately, the person who created
I have a large table (more than 10 millions records). this table is heavily
I have a 5 million row table that gets hit with a specific query
I have a table in Sql Server 2008 Express which contains 18 million records.
An application that I'm facing at a customer, looks like this: it allows end

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.