Dear team,

Please explain, which one will be faster in Mysql for the following query?

SELECT * FROM `userstatus` where BINARY Name = 'Raja'

[OR]

SELECT * FROM `userstatus` where Name = 'raja'

Db entry for Name field is 'Raja' there is no key for the field.

I have 1000000 records in my db, i tried with "explain" query but both saying same execution time.

Thank you,

With Regards,
Prem2

i tried with "explain" query but both saying same execution time.

Then there should be no difference.

EXPLAIN doesn't tell you anything about execution time but only about query optimization.

Then there should be no difference.

Why not? A binary comparison does not need any conversion before the comparison, while a non-binary string comparison requires some operations for case matching. Therefore a non-binary comparison should need more time - though I never saw a relevant performance gap in a real-life application between binary and non-binary comparisons.

definitely the first query should be quicker

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.