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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:35:39+00:00 2026-06-06T13:35:39+00:00

I have three or four tables in a MySQL database associated with an upcoming

  • 0

I have three or four tables in a MySQL database associated with an upcoming Android app that potentially may explode to thousands of rows very fast. At this time, I have about 6 – 8 SELECT and 2 INSERT SQL commands that will need to be done.

After doing research, I have found that I will have to use indexing to cut down on load time. I have searched for several tutorials on different sites to see if I can pick this up — but I have found nothing that explains very clearly what and how to to do this.

Here’s the situation:

First and foremast, it will be using a Godaddy MySQL server. Unlimited bandwidth and 150,000 MB. Here is one table that will be getting lots of use:

items_id (int 11)
item (100 varchar) 
cat_id (int 11)

In PHPMyAdmin it says for indexes:

Keyname/PRIMARY  type/PRIMARY        Cardinality/576    items_id

So it appears there is an index established, correct?

Here is one SQL Query (via PHP) related to this table (SELECT):

 "SELECT * FROM items WHERE cat_id = ' ".$_REQUEST['category_id']."' ORDER BY TRIM(LEADING 'The ' FROM item) ASC;"

And another (INSERT):

 "INSERT INTO items (item, cat_id) VALUES ('{$newItem}', '{$cat_id}')"

My main questions are: With these methods, am I utilizing the best speed possible and making use of the established indexes? Or does this have “slow” written all over it?

  • 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-06T13:35:41+00:00Added an answer on June 6, 2026 at 1:35 pm

    Simple selects / inserts cannot be changed to take advantage of indexes.

    But indexes can be added to the tables to make the queries run faster.

    Well actually inserts don’t do anything with indexes unless you’re using InnoDB as a storage engine and foreign key constraints.

    If you’re using a column in the where / group by / order by clauses of a select statement you may consider adding an index on it. A good ideea would be to use EXPLAIN on the queries in cause and see how the database engine uses the columns in the where clause.

    If a column has a small set of non-unique possible values (gender: male/ female) it makes little sense to add an index for it because you won’t be searching for all the females or all the males (and half a table search is not very different than a full table search). But if you use that column along with another column to filter / group / sort you may want to add a composite index (multi-column index) on them.

    Databases within MySQL are organized as folders. The folders contain multiple files for each table.

    There’s a table definition file, a table data file and some index files. If you define an index for a column or multiple columns, a file for that index will be created.

    If you don’t have any indexes not even the primary key, any Select statement is going to do a full table search which for hundreds of thousands of entries becomes noticeably slow.

    If you define an index it will read all the unique values in the table for that column or set of columns and write a file that lists correspondences between a certain value of that column or those columns and the records that contain it.

    That file should be much smaller that the data file and should usually fit into memory entirely along side other index files. MySQL now has to intersect the matching record lists in that file to find out which records match the select criteria and then cherry-pick the data it needs from the data table.

    Primary and Unique indexes have a direct correspondence between one value and one record. So searching by unique value is fast.

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

Sidebar

Related Questions

I have four tables in a MySQL database and I am trying to create
I have four tables. Three of them are tables with one key and they
I have three tables I'd like to join in a way that produces all
Suppose I have a string like this: one two three four five six seven
I have a TableLayout defined in my xml with three columns and four rows
I have an MSM install with four (licensed) sites. Three of them work perfectly
Let's say I have the following xml: <one> <two> <three> <three> foo </three> <four
I have the following HTML markup:- <select name=List1 id=l1> <option>One</option> <option>Two</option> <option>Three</option> <option>Four</option> <option>Five</option>
If i have the following markup; <div id=container> <div id=box> <div id='sameHeight'>One<br>two<br>three</div> <div id='sameHeight'>four</div>
I have a Database named CarsType.accdb there are four fields in the data base

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.