Final results:
A horizontal table is WAY faster if it becomes very big.
Horzontal contains:
262,069 total rows
with id dutch english french german spanish italian romanian as columns
Vertical includes exactly the same information and thus becomes
1,568,702 total rows and only id, languageID, text
====
HORIZONTAL TABLE
- with ID primary (no index further)
SELECT SQL_NO_CACHE english, dutch, id
FROM phrases
WHERE (
dutch
LIKE ‘%hoe%’
OR english
LIKE ‘%hoe%’
)
AND (
dutch
LIKE ‘%lang%’
OR english
LIKE ‘%lang%’
)
AND (
dutch
LIKE ‘%duurt%’
OR english
LIKE ‘%duurt%’
)
LIMIT 0 , 30
==> 0.0081
== On very big database => 0.2149
— 2nd search method
SELECT SQL_NO_CACHE dutch, english
FROM phrases
WHERE id
IN ( 50400011, 60100011, 60100027 )
==> 0.0004 sec
== On very big database => 0.0269
And after putting index on ID (for big table: 0.0013
=========================================================
VERTICAL TABLE
- With language and ID primary, no index further
SELECT SQL_NO_CACHE *
FROM site_phrases
WHERE
(language = 0 OR language = 1)
AND phrase LIKE ‘%hoe%’
AND phrase LIKE ‘%lang%’
AND phrase LIKE ‘%duurt%’
==> 0.0049
== ON very big database ==> 0.7106
— 2nd search method
SELECT SQL_NO_CACHE *
FROM site_phrases
WHERE
(language = 0 OR language = 1)
AND
id IN ( 50400011, 60100011, 60100027 )
==> 0.0007
== ON very big database ==> 0.1460
After putting index on ID ==> 0.0005
And for big table with index ==> 0.0706
the results are very clear: NOT normalizing this table layout is WAY faster