I have a more than Billion records in mysql database , the problem is when I execute a select query it takes more than 3 minutes to search for that string.
So which is the best way to store and retrieve when I have large amount of data? My table has 4 columns:
Serial_no, product_name, product_id, location
The serial number is auto increment from 1. And I have duplicate product_id
exits. I didn't performed any indexing, just created a table and querying using
select * from table where condition
So What Should I do If I want to have a faster query searching?
edit : I am using the below query :
select * from the table where product_name="Example";
Should I change my db to other db?
I would create the index according which is my most used fields in the where in my queries, in this case maybe your main field could be product_id so it should be the cluster index and create a non cluster index with the product_name
CREATE NONCLUSTERED INDEX [itable_productname] ON table
(
product_name ASC
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.