Hi, I am confuse about this cardinality i found out that some of my table have 5 cardinality other table have 20..what does cardinality mean and is this important?
| SitePoint Sponsor |




Hi, I am confuse about this cardinality i found out that some of my table have 5 cardinality other table have 20..what does cardinality mean and is this important?














okay, just to check to make sure, run this for each table and tell me what you get --Code:SELECT COUNT(*) FROM table






that's weird
could you do this for both tables please --Code:SHOW CREATE TABLE table
The Cardinality of a column would be equal to the number of rows returned by SELECT DISTINCT `column1` FROM table1...
how this would be calculated for a TABLE... i dont know. Because surely every row in your table has SOME uniqueness...
Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.




Hi r937, this is the result of show create table
i tried to select count(*) from userrefCREATE TABLE `userref` ( `id` int(11) NOT NULL AUTO_INCREMENT, `First` varchar(20) NOT NULL, `Last` varchar(20) NOT NULL, `MI` varchar(1) NOT NULL, `Addss` varchar(50) NOT NULL, `phone` varchar(11) NOT NULL, `Email` varchar(30) NOT NULL, `Userident` varchar(20) NOT NULL, `Pass` varchar(200) NOT NULL, `Stat` varchar(1) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1
it returns
it has 6 records.6


Stack Overflow has some good explanations of the different meanings of cardinality in databases ... http://stackoverflow.com/questions/1...y-in-databases .
"When talking about database query optimization, cardinality refers to the data in a column of a table, specifically how many unique values are in it. This statistic helps with planning queries and optimizing the execution plans."
or
"When you are looking at query plans, cardinality refers to the number of rows that are expected to be returned from a particular operation."
might be what you are looking for.




Thank you for the reply![]()
Bookmarks