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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:00:45+00:00 2026-05-11T18:00:45+00:00

I need to speed up a query. Is an index table what I’m looking

  • 0

I need to speed up a query. Is an index table what I’m looking for? If so, how do I make one? Do I have to update it each insert?

Here are the table schemas:

--table1--   |   --tableA--   |    --table2--
id           |   id           |    id
attrib1      |   t1id         |    attrib1
attrib2      |   t2id         |    attrib2
             |   attrib1      |

And the query:

SELECT 
  table1.attrib1, 
  table1.attrib2,
  tableA.attrib1 
FROM 
  table1,
  tableA
WHERE 
  table1.id = tableA.t1id
  AND (tableA.t2id = x or ... or tableA.t2id = z)
GROUP BY 
  table1.id
  • 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-11T18:00:45+00:00Added an answer on May 11, 2026 at 6:00 pm

    You need to create a composite index on tableA:

    CREATE INDEX ix_tablea_t1id_t2id ON table_A (t1id, t2id)
    

    Indexes in MySQL are considered a part of a table: they are updated automatically, and used automatically whenever the optimizer decides it’s a good move to use them.

    MySQL does not use the term index table.

    This term is used by Oracle to refer to what other databases call CLUSTERED INDEX: a kind of table where the records themselves are arranged according to the value of a column (or a set of columns).

    In MySQL:

    • When you use MyISAM storage, an index is created as a separate file that has .MYI extension.

      The contents of this file represent a B-Tree, each leaf containing the index key and a pointer to the offset in .MYD file which contains the data.

      The size of the pointer is determined by the server setting called myisam_data_pointer_size, which can vary from 2 to 7 bytes, and defaults to 6 since MySQL 5.0.6.

      This allows creating MyISAM tables up to 2 ^ (8 * 6) bytes = 256 TB

    • In InnoDB, all tables are inherently ordered by the PRIMARY KEY, it does not support heap-organized tables.

      Each index, therefore, in fact is just a plain InnoDB table consisting of a single PRIMARY KEY of N+M records: N records being an indexed value, and M records being a PRIMARY KEY of the main table record which holds the indexed data.

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

Sidebar

Related Questions

I need an SQL guru to help me speed up my query. I have
I need to speed up an sql query. Or handle the php code better.
Suppose I have a set of directed graphs. I need to query those graphs.
I have a table where I'm storing Lat/Long coordinates, and I want to make
I have a database full of recipes, one recipe per row. I need to
I have a MySQL table of correlation data that I need to extract. I
I trying to speed up my site and main problem on it one query
I have a table whose size I'd like to keep down, and one of
I need to speed up my coding, too much work, so I need be
I need to change the connection speed of a port on a switch via

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.