optimization - MySQL InnoDB hash index optimizing -


I was thinking that I can customize it more, maybe someone is struggling with it.

First of all, I have a table:

  create tab 'site_url' (`id`bigint (20) ansnate tap etangement,` url_hash` CHAR (32) tap default Null, 'URL' VARCHAR (2048) Null default tap, Primary key (`ID`), index` url_hash` (` url_hash`)) engine = InnoDB;   

Where do I store site URI (domain is in separate table, but this question does not matter to the purpose of the ID - I hope)

url_hash url

For more optimization,

standard query looks like this:

  Select the id from site_url where the site_url.url_hash = MD5 (' Uc - often counted in the application instead of mysql) and site_url. Url = 'Some - often counted in applications instead of mysql'   

describes:

  + ---- + --- --- ------- + ---------- + ------ + --------------- + ----- --- - + --------- + ------- + ------ + -------------------- - -------------- + | ID | Select_type | Table | Type | Possible_Keys | Key | Key_len | Referee | Rows | Extra | + ---- + ------------- + ---------- + ------ + ------------ --- + ---------- + --------- + ------- + ------ + ---------- -------------------------- + | 1 | Simple | Site_url | Referee | Url_hash | Url_hash | 97 | Constant | 1 | Using index status; Where to use + ---- + ------------- + ---------- + ------ + ------------ --- + ---------- + --------- + ------- + ------ + ---------- -------------------------- +   

But i am thinking that i help mysql do this Can I search It must be done by the InnoDB engine, I can not add the key due to its length of url

My friend asked me to reduce 16 letters, and this number Write as Will index be faster than char (32) on BIGINT ? The friend suggested MD5 and took 16 first / last characters of it, but I think it will bump too much

What are your thoughts about it?

This is your query: Select the id from

The best index of this query will be on the site_url (url_hash, url, id) . The warning is that you may need to use a prefix unless you have a large prefix choice set (see).

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -