-1

I have a Database with ~ 15 Million Entries.

Here is its structure:

enter image description here

SELECT count(*) FROM hash.list; ~ 77 seconds
SELECT * FROM hash.list where plain = "aaaa"; ~~ 94 seconds

How can i make this faster ~ 5 seconds or what else?

DimaSan
  • 12,264
  • 11
  • 65
  • 75
  • How is this question related to PHP and md5? I would also recommend you to post this question in http://dba.stackexchange.com/ instead. – M. Eriksson Oct 05 '16 at 06:19
  • Use indexes! With an index on `plain` (e.g. `alter table hash.list add index (plain(30))`, phpmyadmin doesn't do it for you for `text`-type), your 2nd query should need just milliseconds. This will not improve `count(*)`. 77s seems a lot for 15 million rows with an int primary key, it should be more in the neighborhood of 2-4 seconds, and indicates a read performance from your hdd of ~0,8mb/s. Maybe you are doing a lot of other things on the hdd - or other users in e.g. shared hosting. You can only improve this by improving your overall system performance (especially a faster hdd or more ram). – Solarflare Oct 05 '16 at 08:47

2 Answers2

2

You can do following things to make it fast 1. Idexing ,I think you have done 2. Make partition of this table and only fetch records which fall under your criteria . 3. Also choos Explain to get what is taking most of time in your query .

Mukesh Swami
  • 415
  • 2
  • 11
1

Some suggestions:

Community
  • 1
  • 1
Cine
  • 4,255
  • 26
  • 46