DEV Community

Discussion on: 10x Query Performance with a Database Index

Collapse
 
rouilj profile image
John P. Rouillard

How does:

Return as few rows as possible – switch SELECT * to SELECT column.
Enter fullscreen mode Exit fullscreen mode

work? It certainly returns less data but it shouldn't return fewer rows. I expect the where clause determines the returned rows.

Collapse
 
breachdirectory profile image
BreachDirectory

You should select as few rows as possible - e.g. if you have a table with 1,000,000 rows and your column only has 2,000 and you're selecting data only from that column, your database has less work to do. :)