Performance difference between searching table with 350 columns and searching table with 25 columns I am currently doing some hibernate performance test. My requirement is to search for data in a particular column of a table containing 8 million rows and 350 columns. Currently, I don't have the access to that database, however, the test database that I'm now using also contains 8millions+. 

My question is, is there a significant difference in terms of scan speed when searching for a data in a table that containts 350 columns than in table containing 25 columns?

By the way, the way I check for data is : 

sessionFactory.getCurrentSession().createSQLQuery("SELECT COL_5 from MY_TABLE where COL_5='" + theColValuePassedFromParameter+ "'").list();


Where in if the returned list is empty, the boolean method will return true, else false; I would also appreciate If someone can point me to a better, performant way of searching for a non-primary key data in hibernate. 

Thanks in advance...
If someone can point me to a better, performant way of searching for a non-primary key data [...]


Add an index in your database on the column(s) you are filtering on - in this case COL_5. The resulting execution plan should be a single index seek and the performanze difference negligible (or even zero).



Also rather than getting the entire result set, just check if there is at least one resulting row. You can either add a TOP 1 to your query (or whatever SQL equivalent), or add a .setMaxResults(1).