MySQL SELECT query performance -


this question has answer here:

i have query has list of values checking against single column in multi column table.

example query one......

select `name`, `sleeps`  `properties`  `town`='bude' or `town`='newquay' or `town`='widemouth' or `town`='polzeath' or `town`='crantock' or `town`='perranporth' or `town`='porthmeor' or `town`='st ives' or `town`='porthtowan' 

example query two......

select `name`, `sleeps`  `properties`  `town` in ('bude', 'newquay', 'widemouth', 'polzeath', 'crantock', 'wadebridge', 'porthmeor', 'st ives', 'porthtowan') 
    • -

i have run both in phpmyadmin , found query speed similar, table of approx 5,000 records.

in terms of performance , durability when table contains more data is best go 'in' style query or use multiple instances or?

thanks

this simple test result,

select * item id = 1 or id = 2 ... id = 10000 query took 0.1139 seconds  select * item id in (1,2,3,...10000) query took 0.0413 seconds 

in faster or


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -