Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Elijah
Starting Member
3 Posts |
Posted - 2009-12-20 : 17:32:06
|
| Im just getting back into SQL after about 3 years.Im seeing alot of bad coding on a project im on that is in Coldfusion with more queries being ran on a single page than I have ever seen before. Litterally some pages are hitting 800+db calls.So staring with a basic query for performance purposes which would be less taxing on the server.i.e.Select someFieldFrom tblXWhere id=1 or id=3 or id=10 or id=11 or id=13 or id=19or Select someFieldFrom tblXWhere id in (1,3,10,11,13,19)Thank you for looking. |
|
|
Elijah
Starting Member
3 Posts |
Posted - 2009-12-20 : 17:33:08
|
| Oh, if you could also explain why I would appreciate it also. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
Elijah
Starting Member
3 Posts |
Posted - 2009-12-20 : 18:46:45
|
| Well, if "They are equivalent because the query parser converts IN to ORs anyway."Then it would be more efficient to just write the SQL with the or's in order to no tax the server to do the conversion on the DB server. Am I correct?Thank you for the information.Elijah |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|