A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
video training course this week in the
JDBC and Relational Databases
MySQL : Optimize performance of search on varchar column
Joined: Sep 12, 2008
Feb 04, 2014 15:59:15
I have a customer table having column,
which is varchar(255). In the app we have a search functionality by name. We have about 8 million records in this table. The query is very obvious.
SELECT customer_table_columns FROM customer_table WHERE customer_name LIKE '%user input customer name%';
Now this query runs considerably slow and it annoys the users. I was wondering if there is a way to improve the performance of this query.
There is an index on this column but index type is not defined. Options for index type are FULLTEXT, PRIMARY and UNIQUE.
author & internet detective
Joined: May 26, 2003
Feb 04, 2014 20:16:05
Is the customer really entering that much of a wildcard? Often, the user is entering the starts with. Which lets you do WHERE customer_name LIKE 'user input customer name%';
This lets you use indexes since the order can be sorted instead of needing to scan the whole table.
OCA 8 book
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: MySQL : Optimize performance of search on varchar column
Creating Indexes on Number Columns
Enabling non-programmers to change the output of my code ?
SQL Query for this?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015