Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

umairparacha's avatar

Is there is a better way to perform this query

select name, purchase_price from products where name='alisda' and purchase_price=1

query in MySQL is being executed too long, the table has 50m rows. What’s the best way to analyze and resolve the issue.

0 likes
9 replies
Tippin's avatar

Are the columns you are constraining the query to, indexed? name and purchase_price ?

1 like
umairparacha's avatar

@jlrdw I am not quite familiar with binding parameters. Can you please explain how to bind parameters? Thanks

umairparacha's avatar

@jlrdw Thanks for helping out. what are the advantages of using parameters binding?

Please or to participate in this conversation.