SlideShare una empresa de Scribd logo
1 de 29
WAS IST EIGENTLICH EAV?
        Eine Einführung in das Entity-Attribute-Value Model



                                  PHP User Group Rheinhessen
                                       12.01.2010 Mainz




Daniel Nitz — www.danielnitz.de               1                12.01.2010 — PHPUG-RHH
AGENDA

          1. Definition                  4. Nachteile

          2. Anwendungsbeispiel         5. In der Praxis

          3. Vorteile                   6. Fazit



Daniel Nitz — www.danielnitz.de     2              12.01.2010 — PHPUG-RHH
DEFINITION




Daniel Nitz — www.danielnitz.de       3        12.01.2010 — PHPUG-RHH
DEFINITION


  Entity-Attribute-Value Model, auch bekannt als Object-
  Attribute-Value Model und Open Schema ist ein Datenmodell,
  welches dann zum Einsatz kommt, wenn die Anzahl der
  Attribute (Eigenschaften, Parameter) zur Beschreibung einer
  Sache (Entität oder Objekt) im Vorfeld nicht vorhersehbar sind.



Daniel Nitz — www.danielnitz.de       4           12.01.2010 — PHPUG-RHH
DEFINITION



  EAV ist ein Datenmodell für den Fall, dass die Anzahl der
  Attribute eines Objektes nicht vorhersehbar sind.




Daniel Nitz — www.danielnitz.de       5           12.01.2010 — PHPUG-RHH
DEFINITION


  Entity: Repräsentiert einen Datensatz, z.B. eine Produkt.

  Attribute: Stellt eine Eigenschaft dar, z.B. Größe, Farbe etc.

  Value: Beinhaltet den Eigenschaftswert, z.B. XL, blau etc.



Daniel Nitz — www.danielnitz.de       6                12.01.2010 — PHPUG-RHH
DEFINITION

                                  1:n               1:1
                  Entity                Attribute            Value




                       3 Tabellen verknüpft mittels Foreign Keys.



Daniel Nitz — www.danielnitz.de             7                12.01.2010 — PHPUG-RHH
HÄ?



Daniel Nitz — www.danielnitz.de    8    12.01.2010 — PHPUG-RHH
ANWENDUNGSBEISPIEL
           Unterschied EAV im Vergleich zum relationalen Design




Daniel Nitz — www.danielnitz.de     9                 12.01.2010 — PHPUG-RHH
ANWENDUNGSBEISPIEL

‣   Eine Person wird anhand einer eindeutigen Nummer
    identifiziert

‣   Eine Person hat einen Vornamen

‣   Eine Person hat einen Nachnamen

‣   Ein Person hat eine beliebige Anzahl von zusätzlichen
    Informationen (Alter, Gewicht, Größe etc.)
Daniel Nitz — www.danielnitz.de   10                12.01.2010 — PHPUG-RHH
RELATIONALES DESIGN
                                   Person             Data

                                  person_id   1:1   person_id
                                  first_name         age
                                  last_name         weight
                                                    height




Daniel Nitz — www.danielnitz.de               11                12.01.2010 — PHPUG-RHH
EAV DESIGN

                  Entity                  Attribute               Value
                                                         1:1
               entity_id          1:n
                                        attribute_id           attribute_id
                                        entity_id              value
                                        attribute_name




Daniel Nitz — www.danielnitz.de               12                 12.01.2010 — PHPUG-RHH
STORY
Relationales Design:
Die Person mit der Nummer 1 hat das Alter 30, hat ein Gewicht von 80,
hat eine Größe von 180.


EAV Design:
Die Person mit der Nummer 1 hat das Attribut Alter mit dem Wert 30.

Die Person mit der Nummer 1 hat das Attribut Gewicht mit dem Wert 80.

Die Person mit der Nummer 1 hat das Attribut Größe mit dem Wert 180.

 Daniel Nitz — www.danielnitz.de     13                 12.01.2010 — PHPUG-RHH
DESIGN PROBLEME


‣   keine Datentypen

‣   keine definierten Spalten-/Attributsets

‣   Redundanz von Attributen

‣   keine Integrität


Daniel Nitz — www.danielnitz.de   14         12.01.2010 — PHPUG-RHH
EAV DESIGN

                  Entity                  Attribute                            Value
                                                               1:1
               entity_id          1:n
                                        attribute_id                        attribute_id
                                        entity_id                           value_id
                                        attribute_name

                                                         1:1                            1:1



                                                                Value Int                Value ...

                                                               value_id                value_id
                                                               value                   value


Daniel Nitz — www.danielnitz.de               15                              12.01.2010 — PHPUG-RHH
EAV DESIGN

                  Entity                    Entity_Attribute                         Value
                                                                     1:1
               entity_id          1:n
                                            ea_id                                 ea_id
                                            entity_id                             value_id
                                            attribute_id
                                            as_id
                                                               1:1                            1:1



               Attribute Set              Attribute                   Value Int                Value ...

             as_id                      attribute_id                 value_id                value_id
             as_name                    attribute_name               value                   value


Daniel Nitz — www.danielnitz.de                   16                                12.01.2010 — PHPUG-RHH
DESIGN PROBLEME


‣   verschiedene Datentypen

‣   definierte Spalten-/Attributsets

‣   keine Redundanz von Attributen

‣   Integrität gewahrt


Daniel Nitz — www.danielnitz.de   17   12.01.2010 — PHPUG-RHH
VORTEILE




Daniel Nitz — www.danielnitz.de      18      12.01.2010 — PHPUG-RHH
VORTEILE


‣   Hohe Flexibilität in der Gestaltung von Objektstrukturen

‣   Kein DBA zur Änderung der Schemata nötig

‣   Keine zusätzliche Programmierung bei Änderung der
    Schemata nötig


Daniel Nitz — www.danielnitz.de      19            12.01.2010 — PHPUG-RHH
NACHTEILE




Daniel Nitz — www.danielnitz.de       20      12.01.2010 — PHPUG-RHH
NACHTEILE


‣   Hohe Systemlast durch komplizierte SQL Queries

‣   Komplexe Programmierung von SQL Statements

‣   Verlust von DBMS-spezifischen Funktionalitäten

‣   Verlagerung von DBMS-Funktionen in die Anwendungslogik


Daniel Nitz — www.danielnitz.de       21            12.01.2010 — PHPUG-RHH
IN DER PRAXIS




Daniel Nitz — www.danielnitz.de         22        12.01.2010 — PHPUG-RHH
EAV MODEL LIBRARY

Dmg_Db_Eav:
‣   EAV Model Implementierung für das Zend Framework

‣   Auf Basis von Zend_Db und Zend_Db_Table

‣   Nutzung von Zend_Cache



Daniel Nitz — www.danielnitz.de   23          12.01.2010 — PHPUG-RHH
CODE BEISPIEL

 $options = new Dmg_Db_Eav_Config($array);

 // Person implements Dmg_Db_Eav_Abstract
 $personModel = new Person($options);

 $persons = $personModel->addAttributeFilter('age', 30)
    	 	 	 	 	           ->addAttributeFilter('name', 'daniel')
                        ->addFilter('active', 1)
                        ->addLimit(10)
                        ->load();




Daniel Nitz — www.danielnitz.de         24         12.01.2010 — PHPUG-RHH
CODE BEISPIEL
foreach ($persons as $person) {
	 $attributes = $person->getAttributes();
	 foreach ($attributes as $attribute) {
	 	 if (!$attribute->hasOptions()) {
	 	 	 echo $attribute->getName() . ': ' . $attribute->getValue();
	 	 } else {
	 	 	 foreach ($attribute->getOptions() as $option) {
	 	 	 	 echo $option->getName() . ': ' . $option->getValue();
	 	 	 }
	 	 }
	 }
}



Daniel Nitz — www.danielnitz.de         25        12.01.2010 — PHPUG-RHH
PERFORMANCE
 #            Time                                                                         Query
 1     0.223762989044    connect

                         SELECT `e`.*, `v`.*, `a`.*, `as`.*, `g`.*, `ga`.* FROM `eav_entity` AS `e` INNER JOIN `eav_value` AS `v` ON e.entity_id = v.entity_id INNER
                         JOIN `eav_attribute` AS `a` ON v.attribute_id = a.attribute_id INNER JOIN `eav_attribute_set` AS `as` ON e.attribute_set_id =
 2     0.42297410965
                         as.attribute_set_id INNER JOIN `eav_attribute_group` AS `g` ON g.attribute_set_id = as.attribute_set_id INNER JOIN
                         `eav_attribute_group_attribute` AS `ga` ON a.attribute_id = ga.attribute_id WHERE (e.entity_id = 1)

 3     0.0507569313049   DESCRIBE `eav_entity`

                         SELECT eav_value_varchar.*, CONCAT('varchar') AS type FROM eav_value_varchar WHERE value_id IN (1, 3) UNION SELECT
 4     0.757645130157    eav_value_int.*, CONCAT('int') AS type FROM eav_value_int WHERE value_id IN (2) UNION SELECT eav_value_text.*, CONCAT('text') AS
                         type FROM eav_value_text WHERE value_id IN (4)


 ...            ...                                                                           ...



Query Zeit beim Laden eines EAV Objektes ohne Cache mit 4
Attributen, eines davon hat 6 Attributoptionen: 1.949 sec
Nach dem Caching: 0.079 sec
Daniel Nitz — www.danielnitz.de                                             26                                                  12.01.2010 — PHPUG-RHH
FAZIT




Daniel Nitz — www.danielnitz.de     27    12.01.2010 — PHPUG-RHH
FAZIT

‣   EAV bietet gute Möglichkeiten eine Anwendung in der
    Datenschicht flexibel zu halten.

‣   Es gibt jedoch nur wenige Anwendungsfälle, in denen eine EAV
    Implementierung wirklich sinnvoll ist.

‣   Ein relationales Design sollte dem EAV, wenn möglich,
    vorgezogen werden.

Daniel Nitz — www.danielnitz.de     28             12.01.2010 — PHPUG-RHH
VIELEN DANK!

                                            Daniel Nitz
                                            [ zend certified engineer ]

                                            daniel@danielnitz.de
                                            twitter.com/danielnitz




Daniel Nitz — www.danielnitz.de        29                 12.01.2010 — PHPUG-RHH

Más contenido relacionado

La actualidad más candente

Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
ArangoDB Database
 
Manage schema object.ppt
Manage schema object.pptManage schema object.ppt
Manage schema object.ppt
AhmadUsman79
 
Real Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case StudyReal Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case Study
Nati Shalom
 
الوحدة الأولى الشبكات السلكية واللاسلكية
الوحدة الأولى الشبكات السلكية واللاسلكيةالوحدة الأولى الشبكات السلكية واللاسلكية
الوحدة الأولى الشبكات السلكية واللاسلكية
Lumah Madany
 

La actualidad más candente (20)

Pentaho
PentahoPentaho
Pentaho
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
 
Apache hive
Apache hiveApache hive
Apache hive
 
Manage schema object.ppt
Manage schema object.pptManage schema object.ppt
Manage schema object.ppt
 
Virtual Private Network VPN
Virtual Private Network VPNVirtual Private Network VPN
Virtual Private Network VPN
 
Real Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case StudyReal Time Analytics for Big Data a Twitter Case Study
Real Time Analytics for Big Data a Twitter Case Study
 
Informatica Powercenter Architecture
Informatica Powercenter ArchitectureInformatica Powercenter Architecture
Informatica Powercenter Architecture
 
Retail Analytics and BI with Looker, BigQuery, GCP & Leigha Jarett
Retail Analytics and BI with Looker, BigQuery, GCP & Leigha JarettRetail Analytics and BI with Looker, BigQuery, GCP & Leigha Jarett
Retail Analytics and BI with Looker, BigQuery, GCP & Leigha Jarett
 
Accelerate and modernize your data pipelines
Accelerate and modernize your data pipelinesAccelerate and modernize your data pipelines
Accelerate and modernize your data pipelines
 
الوحدة الأولى الشبكات السلكية واللاسلكية
الوحدة الأولى الشبكات السلكية واللاسلكيةالوحدة الأولى الشبكات السلكية واللاسلكية
الوحدة الأولى الشبكات السلكية واللاسلكية
 
Talend Components | tMap, tJoin, tFileList, tInputFileDelimited | Talend Onli...
Talend Components | tMap, tJoin, tFileList, tInputFileDelimited | Talend Onli...Talend Components | tMap, tJoin, tFileList, tInputFileDelimited | Talend Onli...
Talend Components | tMap, tJoin, tFileList, tInputFileDelimited | Talend Onli...
 
Modelo E-R
Modelo E-RModelo E-R
Modelo E-R
 
Get Savvy with Snowflake
Get Savvy with SnowflakeGet Savvy with Snowflake
Get Savvy with Snowflake
 
Intro to Neo4j
Intro to Neo4jIntro to Neo4j
Intro to Neo4j
 
MCITP
MCITPMCITP
MCITP
 
Microsoft Fabric: How to Accelerate AI with Data
Microsoft Fabric: How to Accelerate AI with DataMicrosoft Fabric: How to Accelerate AI with Data
Microsoft Fabric: How to Accelerate AI with Data
 
SQOOP PPT
SQOOP PPTSQOOP PPT
SQOOP PPT
 
Dojo 02 : Introduction au noSQL
Dojo 02 : Introduction au noSQLDojo 02 : Introduction au noSQL
Dojo 02 : Introduction au noSQL
 
03 hive query language (hql)
03 hive query language (hql)03 hive query language (hql)
03 hive query language (hql)
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java code
 

Destacado

Entity Attribute Value (Eav)
Entity   Attribute   Value (Eav)Entity   Attribute   Value (Eav)
Entity Attribute Value (Eav)
Tâm
 
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
Erik Fransen
 
Data warehouse architecture
Data warehouse architectureData warehouse architecture
Data warehouse architecture
pcherukumalla
 

Destacado (13)

Eav Data Model Concepts
Eav Data Model ConceptsEav Data Model Concepts
Eav Data Model Concepts
 
Entity Attribute Value (Eav)
Entity   Attribute   Value (Eav)Entity   Attribute   Value (Eav)
Entity Attribute Value (Eav)
 
Extensible Data Modeling
Extensible Data ModelingExtensible Data Modeling
Extensible Data Modeling
 
Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)
 
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
Best Practices: Datawarehouse Automation Conference September 20, 2012 - Amst...
 
Practical Object Oriented Models In Sql
Practical Object Oriented Models In SqlPractical Object Oriented Models In Sql
Practical Object Oriented Models In Sql
 
Implementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsImplementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord models
 
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
 
SQL Outer Joins for Fun and Profit
SQL Outer Joins for Fun and ProfitSQL Outer Joins for Fun and Profit
SQL Outer Joins for Fun and Profit
 
Modern Data Architecture
Modern Data ArchitectureModern Data Architecture
Modern Data Architecture
 
Data warehouse architecture
Data warehouse architectureData warehouse architecture
Data warehouse architecture
 
Data Warehouse Design and Best Practices
Data Warehouse Design and Best PracticesData Warehouse Design and Best Practices
Data Warehouse Design and Best Practices
 
Building an Effective Data Warehouse Architecture
Building an Effective Data Warehouse ArchitectureBuilding an Effective Data Warehouse Architecture
Building an Effective Data Warehouse Architecture
 

Was ist eigentlich EAV?

  • 1. WAS IST EIGENTLICH EAV? Eine Einführung in das Entity-Attribute-Value Model PHP User Group Rheinhessen 12.01.2010 Mainz Daniel Nitz — www.danielnitz.de 1 12.01.2010 — PHPUG-RHH
  • 2. AGENDA 1. Definition 4. Nachteile 2. Anwendungsbeispiel 5. In der Praxis 3. Vorteile 6. Fazit Daniel Nitz — www.danielnitz.de 2 12.01.2010 — PHPUG-RHH
  • 3. DEFINITION Daniel Nitz — www.danielnitz.de 3 12.01.2010 — PHPUG-RHH
  • 4. DEFINITION Entity-Attribute-Value Model, auch bekannt als Object- Attribute-Value Model und Open Schema ist ein Datenmodell, welches dann zum Einsatz kommt, wenn die Anzahl der Attribute (Eigenschaften, Parameter) zur Beschreibung einer Sache (Entität oder Objekt) im Vorfeld nicht vorhersehbar sind. Daniel Nitz — www.danielnitz.de 4 12.01.2010 — PHPUG-RHH
  • 5. DEFINITION EAV ist ein Datenmodell für den Fall, dass die Anzahl der Attribute eines Objektes nicht vorhersehbar sind. Daniel Nitz — www.danielnitz.de 5 12.01.2010 — PHPUG-RHH
  • 6. DEFINITION Entity: Repräsentiert einen Datensatz, z.B. eine Produkt. Attribute: Stellt eine Eigenschaft dar, z.B. Größe, Farbe etc. Value: Beinhaltet den Eigenschaftswert, z.B. XL, blau etc. Daniel Nitz — www.danielnitz.de 6 12.01.2010 — PHPUG-RHH
  • 7. DEFINITION 1:n 1:1 Entity Attribute Value 3 Tabellen verknüpft mittels Foreign Keys. Daniel Nitz — www.danielnitz.de 7 12.01.2010 — PHPUG-RHH
  • 8. HÄ? Daniel Nitz — www.danielnitz.de 8 12.01.2010 — PHPUG-RHH
  • 9. ANWENDUNGSBEISPIEL Unterschied EAV im Vergleich zum relationalen Design Daniel Nitz — www.danielnitz.de 9 12.01.2010 — PHPUG-RHH
  • 10. ANWENDUNGSBEISPIEL ‣ Eine Person wird anhand einer eindeutigen Nummer identifiziert ‣ Eine Person hat einen Vornamen ‣ Eine Person hat einen Nachnamen ‣ Ein Person hat eine beliebige Anzahl von zusätzlichen Informationen (Alter, Gewicht, Größe etc.) Daniel Nitz — www.danielnitz.de 10 12.01.2010 — PHPUG-RHH
  • 11. RELATIONALES DESIGN Person Data person_id 1:1 person_id first_name age last_name weight height Daniel Nitz — www.danielnitz.de 11 12.01.2010 — PHPUG-RHH
  • 12. EAV DESIGN Entity Attribute Value 1:1 entity_id 1:n attribute_id attribute_id entity_id value attribute_name Daniel Nitz — www.danielnitz.de 12 12.01.2010 — PHPUG-RHH
  • 13. STORY Relationales Design: Die Person mit der Nummer 1 hat das Alter 30, hat ein Gewicht von 80, hat eine Größe von 180. EAV Design: Die Person mit der Nummer 1 hat das Attribut Alter mit dem Wert 30. Die Person mit der Nummer 1 hat das Attribut Gewicht mit dem Wert 80. Die Person mit der Nummer 1 hat das Attribut Größe mit dem Wert 180. Daniel Nitz — www.danielnitz.de 13 12.01.2010 — PHPUG-RHH
  • 14. DESIGN PROBLEME ‣ keine Datentypen ‣ keine definierten Spalten-/Attributsets ‣ Redundanz von Attributen ‣ keine Integrität Daniel Nitz — www.danielnitz.de 14 12.01.2010 — PHPUG-RHH
  • 15. EAV DESIGN Entity Attribute Value 1:1 entity_id 1:n attribute_id attribute_id entity_id value_id attribute_name 1:1 1:1 Value Int Value ... value_id value_id value value Daniel Nitz — www.danielnitz.de 15 12.01.2010 — PHPUG-RHH
  • 16. EAV DESIGN Entity Entity_Attribute Value 1:1 entity_id 1:n ea_id ea_id entity_id value_id attribute_id as_id 1:1 1:1 Attribute Set Attribute Value Int Value ... as_id attribute_id value_id value_id as_name attribute_name value value Daniel Nitz — www.danielnitz.de 16 12.01.2010 — PHPUG-RHH
  • 17. DESIGN PROBLEME ‣ verschiedene Datentypen ‣ definierte Spalten-/Attributsets ‣ keine Redundanz von Attributen ‣ Integrität gewahrt Daniel Nitz — www.danielnitz.de 17 12.01.2010 — PHPUG-RHH
  • 18. VORTEILE Daniel Nitz — www.danielnitz.de 18 12.01.2010 — PHPUG-RHH
  • 19. VORTEILE ‣ Hohe Flexibilität in der Gestaltung von Objektstrukturen ‣ Kein DBA zur Änderung der Schemata nötig ‣ Keine zusätzliche Programmierung bei Änderung der Schemata nötig Daniel Nitz — www.danielnitz.de 19 12.01.2010 — PHPUG-RHH
  • 20. NACHTEILE Daniel Nitz — www.danielnitz.de 20 12.01.2010 — PHPUG-RHH
  • 21. NACHTEILE ‣ Hohe Systemlast durch komplizierte SQL Queries ‣ Komplexe Programmierung von SQL Statements ‣ Verlust von DBMS-spezifischen Funktionalitäten ‣ Verlagerung von DBMS-Funktionen in die Anwendungslogik Daniel Nitz — www.danielnitz.de 21 12.01.2010 — PHPUG-RHH
  • 22. IN DER PRAXIS Daniel Nitz — www.danielnitz.de 22 12.01.2010 — PHPUG-RHH
  • 23. EAV MODEL LIBRARY Dmg_Db_Eav: ‣ EAV Model Implementierung für das Zend Framework ‣ Auf Basis von Zend_Db und Zend_Db_Table ‣ Nutzung von Zend_Cache Daniel Nitz — www.danielnitz.de 23 12.01.2010 — PHPUG-RHH
  • 24. CODE BEISPIEL $options = new Dmg_Db_Eav_Config($array); // Person implements Dmg_Db_Eav_Abstract $personModel = new Person($options); $persons = $personModel->addAttributeFilter('age', 30) ->addAttributeFilter('name', 'daniel') ->addFilter('active', 1) ->addLimit(10) ->load(); Daniel Nitz — www.danielnitz.de 24 12.01.2010 — PHPUG-RHH
  • 25. CODE BEISPIEL foreach ($persons as $person) { $attributes = $person->getAttributes(); foreach ($attributes as $attribute) { if (!$attribute->hasOptions()) { echo $attribute->getName() . ': ' . $attribute->getValue(); } else { foreach ($attribute->getOptions() as $option) { echo $option->getName() . ': ' . $option->getValue(); } } } } Daniel Nitz — www.danielnitz.de 25 12.01.2010 — PHPUG-RHH
  • 26. PERFORMANCE # Time Query 1 0.223762989044 connect SELECT `e`.*, `v`.*, `a`.*, `as`.*, `g`.*, `ga`.* FROM `eav_entity` AS `e` INNER JOIN `eav_value` AS `v` ON e.entity_id = v.entity_id INNER JOIN `eav_attribute` AS `a` ON v.attribute_id = a.attribute_id INNER JOIN `eav_attribute_set` AS `as` ON e.attribute_set_id = 2 0.42297410965 as.attribute_set_id INNER JOIN `eav_attribute_group` AS `g` ON g.attribute_set_id = as.attribute_set_id INNER JOIN `eav_attribute_group_attribute` AS `ga` ON a.attribute_id = ga.attribute_id WHERE (e.entity_id = 1) 3 0.0507569313049 DESCRIBE `eav_entity` SELECT eav_value_varchar.*, CONCAT('varchar') AS type FROM eav_value_varchar WHERE value_id IN (1, 3) UNION SELECT 4 0.757645130157 eav_value_int.*, CONCAT('int') AS type FROM eav_value_int WHERE value_id IN (2) UNION SELECT eav_value_text.*, CONCAT('text') AS type FROM eav_value_text WHERE value_id IN (4) ... ... ... Query Zeit beim Laden eines EAV Objektes ohne Cache mit 4 Attributen, eines davon hat 6 Attributoptionen: 1.949 sec Nach dem Caching: 0.079 sec Daniel Nitz — www.danielnitz.de 26 12.01.2010 — PHPUG-RHH
  • 27. FAZIT Daniel Nitz — www.danielnitz.de 27 12.01.2010 — PHPUG-RHH
  • 28. FAZIT ‣ EAV bietet gute Möglichkeiten eine Anwendung in der Datenschicht flexibel zu halten. ‣ Es gibt jedoch nur wenige Anwendungsfälle, in denen eine EAV Implementierung wirklich sinnvoll ist. ‣ Ein relationales Design sollte dem EAV, wenn möglich, vorgezogen werden. Daniel Nitz — www.danielnitz.de 28 12.01.2010 — PHPUG-RHH
  • 29. VIELEN DANK! Daniel Nitz [ zend certified engineer ] daniel@danielnitz.de twitter.com/danielnitz Daniel Nitz — www.danielnitz.de 29 12.01.2010 — PHPUG-RHH