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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:53:28+00:00 2026-05-26T23:53:28+00:00

Working with MySQL database. I have a store table. The store table has at

  • 0

Working with MySQL database.

I have a store table. The store table has at least 80,000 records. A user can search the store table by selecting a suburb from a drop down list. Would I be better off creating a suburb table (see below) and searching the store table for the suburb id or keeping it as a text match on the store table?

Store
- id
- name
- suburb_id

Suburb
- id
- name

I am guessing that using the store_id foreign key, I can create and index?

  • 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-26T23:53:29+00:00Added an answer on May 26, 2026 at 11:53 pm

    You are likely better off to create the suburb table as you have suggested. Database normalization best practice here would be to store the suburb_id with the store record. If it is an integer id, you are likely to get much better performance out of it than relying on a text match even if the CHAR()/VARCHAR() column containing is indexed.

    Normalizing your suburb table will give you some added benefits when querying as well. If you ever added additional columns (besides just id, name) to the suburb table, you could, by way of a JOIN query for stores having different suburb attributes or aggregates. (Not that your end users would need this necessarily, but you could use it)

    For example, how many stores per suburb? (you could do this with a text field as well)

    SELECT
     Suburb.name,
     count(*) as numstores 
    FROM Store LEFT JOIN Suburb ON Store.suburb_id = Suburb.id
    GROUP BY Suburb.name
    

    Or if you added the population to your Suburb table, which stores are in suburbs with popultaion > 40000. You could not do this with a text field alone in your Store table.

    SELECT 
      Store.id, 
      Store.name
    From Store JOIN Suburb ON Store.suburb_id = Suburb.id
    WHERE Suburb.population >= 40000
    

    Normalization will also help if you wish to store a user’s suburb preference for later use. Hypothetically, in your Users table, you would add a column as a foreign key reference to Suburb.id. Making use of the ON DELETE SET NULL foreign key actions, if a suburb is removed from the database that change could be immediately reflected in your user’s preference.

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

Sidebar

Related Questions

I'm working with a MySQL database that has some data imported from Excel .
I am working on a site that has tests users can take. I have
I have some tables in a MySQL database to represent records from a sensor.
I have an ecommerce MySQL database that stores order information in the table 'orders'
I am working on a MySQL database that is huge (about 120 tables). I
I am working with a rather large mysql database (several million rows) with a
I'm currently working on a PHP application that uses a MySQL database for its
I'm working on a database with mysql 5.0 for an open source project it's
I'm working on a SaaS project and mysql is our main database. Our applications
I am working with multiple databases in a PHP/MySQL application. I have development, testing,

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.