How to increase performance with joins to create VIEW from Wordpress wp_usermeta After a lot of searching, I finally was able to create a SQL Query to retrive Wordpress User Meta Data. Now the problem is, the performance is so bad it doesn't even show me a result after 30 min. 

Wordpress stores data in 3 columns: user_id, meta_key, meta_value. 
So each entry gets one row. 
What I need is one row per user, with each meta_key as its own column. 

In other words, I have this: 

user_id | meta_key | meta_value
       1|Name      |David
       1|Lastname  |Brown


But I need this: 

user_id|Name |Lastname
      1|David|Brown


My approch on this is:

select m1.user_id, m1.meta_value as Vorname_M, m2.meta_value as Nachname_M,m3.meta_value as Adresse_M
from wp_usermeta m1
join wp_usermeta m2 on (m1.user_id = m2.user_id and m2.meta_key =  'nachname')
join wp_usermeta m3 on (m2.user_id = m3.user_id and m3.meta_key = 'adress')
where m1.meta_key = 'vorname'


With 5 joins it still works, but takes already 4 sec. All in all there are actually 17 joins, and at this point it doesnt show me anything. 

I am running the query in phpMyAdmin, and would like to create a VIEW out of the result. 

Now the actual question is: How can I increase the perfomance on my query, or how to rewrite it? I am givng my best, but I am actually a starter in SQL. 

MySql version: 5.5
In this case you don't need to join the table to itself.  If you only query it once then it will go faster.

SELECT user_id, 
    MAX(CASE WHEN meta_key='vorname' THEN meta_value ELSE null END) Vorname_M,
    MAX(CASE WHEN meta_key='nachname' THEN meta_value ELSE null END) Nachname_M,
    MAX(CASE WHEN meta_key='adress' THEN meta_value ELSE null END) Adresse_M
FROM wp_usermeta
GROUP BY user_id