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

  • Home
  • SEARCH
  • 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 4058766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:07:16+00:00 2026-05-20T15:07:16+00:00

EDIT: When I remove the index on the column that I’m searching in, the

  • 0

EDIT: When I remove the index on the column that I’m searching in, the response time goes from around 2.5 to around 2.6 sec. Should the difference not be a hell of lot more?

I’m writing a small application that uses a jquery autosuggest plugin. The user starts typing the name of his home town and my code queries a table of 2.7 million rows containing city names (maxmind city database) with AJAX. I set an index on the db column being searched (city_name).

When I run the following query (using CodeIgniter Active Record) CI’s benchmark class reports 2.1922 sec (for that query only, so this does not include html page load times).

SELECT * FROM cities WHERE city_name
LIKE “%bang%”

When I run the same query in phpmyadmin I get: Query took 0.0068 sec


When I run

SELECT * FROM cities WHERE city_name
LIKE “%bangkok%”

CI’s benchmark class reports 2.1951 sec. When I run this same query in phpmyadmin I get: Query took 2.1811 sec.

So while CI’s response times are almost identical for both queries, the ones run in phpmyadmin are vastly different.

Questions

  • Obviously querying 2.7 million rows will be relatively slow, but is there any way I get can decent response times for such an auto suggest functionality? 2.5 sec is way too slow. AFAIK there is no fast way to search with a “LIKE” syntax in a PHP array containing all 2.7 million rows. Would memcache be an option?

  • Why are the response time differences negligible when using CI Active Record, but so vastly different in phpmyadmin?

  • 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-20T15:07:17+00:00Added an answer on May 20, 2026 at 3:07 pm

    You can get significant benefit (at least 100 times faster) by indexing the column you are searching for.

    Take a look at 7.3.1. How MySQL Uses Indexes.

    EDIT

    Either phpmyadmin and your benchmark tool are running on the same machine? Phpmyadmin is supposed to run on the same machine than the database, but the benchmark tool could not. In the time measuring, the benchmark tool might probably take into account the network time overload (not the html rendering page).

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

Sidebar

Related Questions

Edit: From another question I provided an answer that has links to a lot
have downloaded Orca to edit an MSI file. I want to remove some banner
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
I have a .htaccess file to remove the index.php part of the codeigniter-style URL.
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT What small things which are too easy to overlook do I need to
Edit : Solved, there was a trigger with a loop on the table (read
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know

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.