Re: Query Slowness
Incidentally, the usual method for querying against the eav method is to first resolve it as a pseudo normalised table. The pattern for that is as follows...
SELECT * FROM eav_hell;
+--------+----------+---------------+------+
| app_id | question | answer | user |
+--------+----------+---------------+------+
| 245 | country | Uganda | 654 |
| 245 | email | bob@email.com | 654 |
| 245 | name | Bob Smith | 654 |
| 245 | state | NY | 654 |
| 245 | status | 0 | 654 |
+--------+----------+---------------+------+
SELECT app_id
, user
, MAX(CASE WHEN question = 'country' THEN answer END) country
, MAX(CASE WHEN question = 'email' THEN answer END) email
, MAX(CASE WHEN question = 'name' THEN answer END) name
, MAX(CASE WHEN question = 'state' THEN answer END) state
, MAX(CASE WHEN question = 'status' THEN answer END) status
, MAX(CASE WHEN question = 'alias' THEN answer END) alias
FROM eav_hell
GROUP
BY app_id
, user;
+--------+------+---------+---------------+-----------+-------+--------+-------+
| app_id | user | country | email | name | state | status | alias |
+--------+------+---------+---------------+-----------+-------+--------+-------+
| 245 | 654 | Uganda | bob@email.com | Bob Smith | NY | 0 | NULL |
+--------+------+---------+---------------+-----------+-------+--------+-------+
Subject
Written By
Posted
Re: Query Slowness
July 10, 2012 06:55AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.