SlideShare a Scribd company logo
Entity - Attribute - Value (EAV) Data Model in Magento  @Pờ Đình Tâm
What is EAV EAV can be thought of as “vertical” modeling instead of “horizontal” modeling of columns in a database table. Instead of a table consisting of a number of columns, denoting attributes of a conceptual piece of data, the attributes are stored in one column of a separate table.
Traditional User Table table: user_entity
EAV Style Tables
Structure of an EAV table The entity: Objects are entities (in Magento. Entities are: product, customer, order,…) The attribute: object properties are attributes The value: The value of the attribute
Update SQL: UPDATE `eav_attribute` SET `attribute_id` = ?, `entity_type_id` = ?, `attribute_code` = ?, `attribute_model` = ?, `backend_model` = ?, `backend_type` = ?, `backend_table` = ?, `frontend_model` = ?, `frontend_input` = ?, `frontend_input_renderer` = ?, `frontend_label` = ?, `frontend_class` = ?, `source_model` = ?, `is_global` = ?, `is_visible` = ?, `is_required` = ?, `is_user_defined` = ?, `default_value` = ?, `is_searchable` = ?, `is_filterable` = ?, `is_comparable` = ?, `is_visible_on_front` = ?, `is_html_allowed_on_front` = ?, `is_unique` = ?, `is_used_for_price_rules` = ?, `is_filterable_in_search` = ?, `used_in_product_listing` = ?, `used_for_sort_by` = ?, `is_configurable` = ?, `apply_to` = ?, `position` = ?, `note` = ?, `is_visible_in_advanced_search` = ? WHERE (attribute_id='498') BIND: Array ( [0] => 498 [1] => 4 [2] => sp_test [3] =>  [4] =>  [5] => varchar [6] =>  [7] =>  [8] => text [9] =>  [10] => sp test [11] =>  [12] =>  [13] => 0 [14] => 1 [15] => 0 [16] => 1 [17] =>  [18] => 1 [19] => 0 [20] => 1 [21] => 0 [22] => 1 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] =>  [30] => 0 [31] =>  [32] => 1 )
Delete SQL: DELETE FROM `eav_attribute` WHERE (attribute_id='498')
Read SQL:  SELECT COUNT(DISTINCT e.entity_id)  FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index`  ON cat_index.product_id=e.entity_id  AND cat_index.store_id='1'  AND cat_index.visibility  IN(3, 4)  AND cat_index.category_id='2'  WHERE    (   e.entity_id in    (   SELECT `t1`.`entity_id` FROM `catalog_product_entity_varchar` AS `t1`   LEFT JOIN `catalog_product_entity_varchar` AS `t2`    ON t1.entity_id = t2.entity_id    AND t1.attribute_id = t2.attribute_id    AND t2.store_id='1'    WHERE (t1.store_id = 0)    AND (t1.attribute_id = 498)    AND (IFNULL(t2.value, t1.value) LIKE :attribute_498)    AND    (   t1.entity_id IN   (   SELECT `t1`.`entity_id` FROM `catalog_product_entity_int` AS `t1`   LEFT JOIN `catalog_product_entity_int` AS `t2`    ON t1.entity_id = t2.entity_id    AND t1.attribute_id = t2.attribute_id    AND t2.store_id='1'    WHERE (t1.store_id = 0)    AND (t1.attribute_id = 497)    AND (IFNULL(t2.value, t1.value) IN ('0', '1'))    AND    (   t1.entity_id IN   (   SELECT `t1`.`entity_id`    FROM `catalog_product_entity_int` AS `t1`   LEFT JOIN `catalog_product_entity_int` AS `t2`    ON t1.entity_id = t2.entity_id AND t1.attribute_id = t2.attribute_id    AND t2.store_id='1'    WHERE (t1.store_id = 0) AND (t1.attribute_id = 496) AND (IFNULL(t2.value, t1.value) IN ('0', '1'))   )   )   )   )   )   ) BIND: Array ( [attribute_498] => %ten% )
Read(2)
Read(3) Relation database: SELECT *  FROM Employee  WHERE Name = ‘John’  AND Nationality = ‘English
Read(4) Self Join:  SELECT  t1.ID as 'ID' t1.Value AS ‘Name’,  t2.Value AS ‘Nationality’ t3.Value AS Birthday FROM EAV_Data t1 LEFT JOIN EAV_Data t2 ON t1.ID = t2.ID LEFT JOIN EAV_Data t3 ON t1.ID = t3.ID WHERE t1.Attribute = ‘Name’ AND t1.Value = ‘John’ AND t2.Attribute = ‘Nationality’ AND t2.Value = ‘English’ AND t3.Attribute = ‘Birthday
Good Provides a flexible mechanism to record the attributes associated with any entity. This EAV design requires almost no consideration of the nature of the applicable hierarchical data and requires very little time to implement  The database schema does not change when the model changes
Bad The EAV table doesn't provide a mechanism to create relationships between entities of different sub-types. The EAV table does nothing to provide a grouping of related entity types. The EAV table uses a VARCHAR column for all attribute values regardless if Dates, timestamps, integers, numerics or booleans would be more appropriate Inefficient queries. Where you would execute a simple query returning 20 columns from a single table, you end up with 20 self-joins, one for each column
Solution Take a look at Magento Database Diagram
EAV table with Pivot (3) Pivot SELECT * FROM ( SELECT ID , [100] AS Name , [101] AS Birthday , [102] AS Nationality FROM  ( SELECT ID, EntityID, AttributeID, Value FROM EAV_Table ) p PIVOT ( MAX (Value) FOR AttributeID IN ([100], [101], [102]) ) AS pvt ) WHERE Name = 'John' AND Nationality = 'English'
When Recommend from Amazon SimpleDB:  Principally utilize index and query functions rather than more complex relational database functions Don’t want any administrative burden at all in managing their structured data Want a service that scales automatically up or down in response to demand, without user intervention Require the highest availability and can’t tolerate downtime for data backup or software maintenance
Thanks for your attention
Ad

More Related Content

What's hot (20)

Data warehouse logical design
Data warehouse logical designData warehouse logical design
Data warehouse logical design
Er. Nawaraj Bhandari
 
Warehousing dimension star-snowflake_schemas
Warehousing dimension star-snowflake_schemasWarehousing dimension star-snowflake_schemas
Warehousing dimension star-snowflake_schemas
Eric Matthews
 
SQL for Data Science Tutorial | Data Science Tutorial | Edureka
SQL for Data Science Tutorial | Data Science Tutorial | EdurekaSQL for Data Science Tutorial | Data Science Tutorial | Edureka
SQL for Data Science Tutorial | Data Science Tutorial | Edureka
Edureka!
 
Data warehousing and online analytical processing
Data warehousing and online analytical processingData warehousing and online analytical processing
Data warehousing and online analytical processing
VijayasankariS
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
Dhani Ahmad
 
Data administration
Data administrationData administration
Data administration
Prof. Erwin Globio
 
Database
DatabaseDatabase
Database
Respa Peter
 
Data warehousing Demo PPTS | Over View | Introduction
Data warehousing Demo PPTS | Over View | Introduction Data warehousing Demo PPTS | Over View | Introduction
Data warehousing Demo PPTS | Over View | Introduction
Kernel Training
 
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)
Ivo Andreev
 
Open Source ETL vs Commercial ETL
Open Source ETL vs Commercial ETLOpen Source ETL vs Commercial ETL
Open Source ETL vs Commercial ETL
Jonathan Levin
 
Oracle Table Partitioning - Introduction
Oracle Table Partitioning  - IntroductionOracle Table Partitioning  - Introduction
Oracle Table Partitioning - Introduction
MyOnlineITCourses
 
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Edureka!
 
Lecture 01 Evolution of Decision Support Systems
Lecture 01 Evolution of Decision Support SystemsLecture 01 Evolution of Decision Support Systems
Lecture 01 Evolution of Decision Support Systems
phanleson
 
Advance DBMS
Advance DBMSAdvance DBMS
Advance DBMS
Md. Mashiur Rahman
 
Data Warehouse Project
Data Warehouse ProjectData Warehouse Project
Data Warehouse Project
Sunny U Okoro
 
Data warehouse
Data warehouseData warehouse
Data warehouse
krishna kumar singh
 
Inside open metadata—the deep dive
Inside open metadata—the deep diveInside open metadata—the deep dive
Inside open metadata—the deep dive
DataWorks Summit
 
Data warehouse
Data warehouseData warehouse
Data warehouse
shachibattar
 
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Neeraj Bhandari
 
Data warehouse presentaion
Data warehouse presentaionData warehouse presentaion
Data warehouse presentaion
sridhark1981
 
Warehousing dimension star-snowflake_schemas
Warehousing dimension star-snowflake_schemasWarehousing dimension star-snowflake_schemas
Warehousing dimension star-snowflake_schemas
Eric Matthews
 
SQL for Data Science Tutorial | Data Science Tutorial | Edureka
SQL for Data Science Tutorial | Data Science Tutorial | EdurekaSQL for Data Science Tutorial | Data Science Tutorial | Edureka
SQL for Data Science Tutorial | Data Science Tutorial | Edureka
Edureka!
 
Data warehousing and online analytical processing
Data warehousing and online analytical processingData warehousing and online analytical processing
Data warehousing and online analytical processing
VijayasankariS
 
Data warehousing Demo PPTS | Over View | Introduction
Data warehousing Demo PPTS | Over View | Introduction Data warehousing Demo PPTS | Over View | Introduction
Data warehousing Demo PPTS | Over View | Introduction
Kernel Training
 
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)
Ivo Andreev
 
Open Source ETL vs Commercial ETL
Open Source ETL vs Commercial ETLOpen Source ETL vs Commercial ETL
Open Source ETL vs Commercial ETL
Jonathan Levin
 
Oracle Table Partitioning - Introduction
Oracle Table Partitioning  - IntroductionOracle Table Partitioning  - Introduction
Oracle Table Partitioning - Introduction
MyOnlineITCourses
 
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Data Warehouse Interview Questions And Answers | Data Warehouse Tutorial | Ed...
Edureka!
 
Lecture 01 Evolution of Decision Support Systems
Lecture 01 Evolution of Decision Support SystemsLecture 01 Evolution of Decision Support Systems
Lecture 01 Evolution of Decision Support Systems
phanleson
 
Data Warehouse Project
Data Warehouse ProjectData Warehouse Project
Data Warehouse Project
Sunny U Okoro
 
Inside open metadata—the deep dive
Inside open metadata—the deep diveInside open metadata—the deep dive
Inside open metadata—the deep dive
DataWorks Summit
 
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Database management system by Neeraj Bhandari ( Surkhet.Nepal )
Neeraj Bhandari
 
Data warehouse presentaion
Data warehouse presentaionData warehouse presentaion
Data warehouse presentaion
sridhark1981
 

Similar to Entity Attribute Value (Eav) (20)

EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV Model
Khoa Truong Dinh
 
EAV in Magento
EAV in MagentoEAV in Magento
EAV in Magento
hazzaz
 
displaytag
displaytagdisplaytag
displaytag
seleciii44
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot net
ssa2010
 
Dat402
Dat402Dat402
Dat402
ssa2010
 
Plone For Developers - World Plone Day, 2009
Plone For Developers - World Plone Day, 2009Plone For Developers - World Plone Day, 2009
Plone For Developers - World Plone Day, 2009
Core Software Group
 
Chris Seebacher Portfolio
Chris Seebacher PortfolioChris Seebacher Portfolio
Chris Seebacher Portfolio
guest3ea163
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data Controls
Randy Connolly
 
Sql Injection Myths and Fallacies
Sql Injection Myths and FallaciesSql Injection Myths and Fallacies
Sql Injection Myths and Fallacies
Karwin Software Solutions LLC
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
paulguerin
 
Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
Iblesoft
 
on SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdfon SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdf
formaxekochi
 
SQL -PHP Tutorial
SQL -PHP TutorialSQL -PHP Tutorial
SQL -PHP Tutorial
Information Technology
 
DP080_Lecture_2 SQL related document.pdf
DP080_Lecture_2 SQL related document.pdfDP080_Lecture_2 SQL related document.pdf
DP080_Lecture_2 SQL related document.pdf
MinhTran394436
 
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasdasdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
MuhamedAhmed35
 
Training on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptxTraining on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptx
naibedyakar00
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
Information Technology
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
OpenSourceIndia
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
suniltomar04
 
Db1 lecture4
Db1 lecture4Db1 lecture4
Db1 lecture4
Sherif Gad
 
EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV Model
Khoa Truong Dinh
 
EAV in Magento
EAV in MagentoEAV in Magento
EAV in Magento
hazzaz
 
Advanced dot net
Advanced dot netAdvanced dot net
Advanced dot net
ssa2010
 
Plone For Developers - World Plone Day, 2009
Plone For Developers - World Plone Day, 2009Plone For Developers - World Plone Day, 2009
Plone For Developers - World Plone Day, 2009
Core Software Group
 
Chris Seebacher Portfolio
Chris Seebacher PortfolioChris Seebacher Portfolio
Chris Seebacher Portfolio
guest3ea163
 
ASP.NET 10 - Data Controls
ASP.NET 10 - Data ControlsASP.NET 10 - Data Controls
ASP.NET 10 - Data Controls
Randy Connolly
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
paulguerin
 
Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
Iblesoft
 
on SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdfon SQL Managment studio(For the following exercise, use the Week 5.pdf
on SQL Managment studio(For the following exercise, use the Week 5.pdf
formaxekochi
 
DP080_Lecture_2 SQL related document.pdf
DP080_Lecture_2 SQL related document.pdfDP080_Lecture_2 SQL related document.pdf
DP080_Lecture_2 SQL related document.pdf
MinhTran394436
 
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasdasdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
asdasdasdasdsadasdasdasdasdsadasdasdasdsadsadasd
MuhamedAhmed35
 
Training on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptxTraining on Microsoft SQL Server(older version).pptx
Training on Microsoft SQL Server(older version).pptx
naibedyakar00
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
OpenSourceIndia
 
Chetan postgresql partitioning
Chetan postgresql partitioningChetan postgresql partitioning
Chetan postgresql partitioning
suniltomar04
 
Ad

Recently uploaded (20)

How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Ad

Entity Attribute Value (Eav)

  • 1. Entity - Attribute - Value (EAV) Data Model in Magento @Pờ Đình Tâm
  • 2. What is EAV EAV can be thought of as “vertical” modeling instead of “horizontal” modeling of columns in a database table. Instead of a table consisting of a number of columns, denoting attributes of a conceptual piece of data, the attributes are stored in one column of a separate table.
  • 3. Traditional User Table table: user_entity
  • 5. Structure of an EAV table The entity: Objects are entities (in Magento. Entities are: product, customer, order,…) The attribute: object properties are attributes The value: The value of the attribute
  • 6. Update SQL: UPDATE `eav_attribute` SET `attribute_id` = ?, `entity_type_id` = ?, `attribute_code` = ?, `attribute_model` = ?, `backend_model` = ?, `backend_type` = ?, `backend_table` = ?, `frontend_model` = ?, `frontend_input` = ?, `frontend_input_renderer` = ?, `frontend_label` = ?, `frontend_class` = ?, `source_model` = ?, `is_global` = ?, `is_visible` = ?, `is_required` = ?, `is_user_defined` = ?, `default_value` = ?, `is_searchable` = ?, `is_filterable` = ?, `is_comparable` = ?, `is_visible_on_front` = ?, `is_html_allowed_on_front` = ?, `is_unique` = ?, `is_used_for_price_rules` = ?, `is_filterable_in_search` = ?, `used_in_product_listing` = ?, `used_for_sort_by` = ?, `is_configurable` = ?, `apply_to` = ?, `position` = ?, `note` = ?, `is_visible_in_advanced_search` = ? WHERE (attribute_id='498') BIND: Array ( [0] => 498 [1] => 4 [2] => sp_test [3] => [4] => [5] => varchar [6] => [7] => [8] => text [9] => [10] => sp test [11] => [12] => [13] => 0 [14] => 1 [15] => 0 [16] => 1 [17] => [18] => 1 [19] => 0 [20] => 1 [21] => 0 [22] => 1 [23] => 0 [24] => 0 [25] => 0 [26] => 0 [27] => 0 [28] => 0 [29] => [30] => 0 [31] => [32] => 1 )
  • 7. Delete SQL: DELETE FROM `eav_attribute` WHERE (attribute_id='498')
  • 8. Read SQL: SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(3, 4) AND cat_index.category_id='2' WHERE ( e.entity_id in ( SELECT `t1`.`entity_id` FROM `catalog_product_entity_varchar` AS `t1` LEFT JOIN `catalog_product_entity_varchar` AS `t2` ON t1.entity_id = t2.entity_id AND t1.attribute_id = t2.attribute_id AND t2.store_id='1' WHERE (t1.store_id = 0) AND (t1.attribute_id = 498) AND (IFNULL(t2.value, t1.value) LIKE :attribute_498) AND ( t1.entity_id IN ( SELECT `t1`.`entity_id` FROM `catalog_product_entity_int` AS `t1` LEFT JOIN `catalog_product_entity_int` AS `t2` ON t1.entity_id = t2.entity_id AND t1.attribute_id = t2.attribute_id AND t2.store_id='1' WHERE (t1.store_id = 0) AND (t1.attribute_id = 497) AND (IFNULL(t2.value, t1.value) IN ('0', '1')) AND ( t1.entity_id IN ( SELECT `t1`.`entity_id` FROM `catalog_product_entity_int` AS `t1` LEFT JOIN `catalog_product_entity_int` AS `t2` ON t1.entity_id = t2.entity_id AND t1.attribute_id = t2.attribute_id AND t2.store_id='1' WHERE (t1.store_id = 0) AND (t1.attribute_id = 496) AND (IFNULL(t2.value, t1.value) IN ('0', '1')) ) ) ) ) ) ) BIND: Array ( [attribute_498] => %ten% )
  • 10. Read(3) Relation database: SELECT * FROM Employee WHERE Name = ‘John’ AND Nationality = ‘English
  • 11. Read(4) Self Join: SELECT t1.ID as 'ID' t1.Value AS ‘Name’, t2.Value AS ‘Nationality’ t3.Value AS Birthday FROM EAV_Data t1 LEFT JOIN EAV_Data t2 ON t1.ID = t2.ID LEFT JOIN EAV_Data t3 ON t1.ID = t3.ID WHERE t1.Attribute = ‘Name’ AND t1.Value = ‘John’ AND t2.Attribute = ‘Nationality’ AND t2.Value = ‘English’ AND t3.Attribute = ‘Birthday
  • 12. Good Provides a flexible mechanism to record the attributes associated with any entity. This EAV design requires almost no consideration of the nature of the applicable hierarchical data and requires very little time to implement The database schema does not change when the model changes
  • 13. Bad The EAV table doesn't provide a mechanism to create relationships between entities of different sub-types. The EAV table does nothing to provide a grouping of related entity types. The EAV table uses a VARCHAR column for all attribute values regardless if Dates, timestamps, integers, numerics or booleans would be more appropriate Inefficient queries. Where you would execute a simple query returning 20 columns from a single table, you end up with 20 self-joins, one for each column
  • 14. Solution Take a look at Magento Database Diagram
  • 15. EAV table with Pivot (3) Pivot SELECT * FROM ( SELECT ID , [100] AS Name , [101] AS Birthday , [102] AS Nationality FROM ( SELECT ID, EntityID, AttributeID, Value FROM EAV_Table ) p PIVOT ( MAX (Value) FOR AttributeID IN ([100], [101], [102]) ) AS pvt ) WHERE Name = 'John' AND Nationality = 'English'
  • 16. When Recommend from Amazon SimpleDB: Principally utilize index and query functions rather than more complex relational database functions Don’t want any administrative burden at all in managing their structured data Want a service that scales automatically up or down in response to demand, without user intervention Require the highest availability and can’t tolerate downtime for data backup or software maintenance
  • 17. Thanks for your attention