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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-12-21 : 08:01:50
|
| Eusebio Barriga writes "Hi!I'm a spanish webdeveloper that make the website www.fametown.com, with a bigger pictures galleries.I have a big problem in my SQL query (SQL 2000) that show the pictures... it need more than 20 seconds to complete. I found that here: "(F.IdPersonaje = 233) OR (F.IdPersonaje = 234)" its the problem. If i only select one F.IdPersonaje the query it's very very fast. But if i add OR... OR... OR... it's very slow. Can i use any alternative???The website of this query is: http://www.fametown.com/sp/fotos.aspx?carpeta=victoriaadams&grp=5&debug=trueTHANKS A LOT !!!SELECT F.Id, C.Nick, F.Cpe, F.IdColaborador, F.Vistas, F.Nombre, F.Ruta, F.Ancho, F.Alto, F.Peso, F.Fecha, F.Puntos, F.NumVotos, P.Nombre As NombrePersonaje FROM Fotos F, Usuarios C, Personajes P WHERE F.Cpe < 60 AND ((F.IdPersonaje = 233) OR (F.IdPersonaje = 234)) AND F.IdColaborador = C.Id AND F.IdPersonaje = P.Id AND F.Id IN (SELECT TOP 1000 F.Id FROM Fotos F, Usuarios C, Personajes P WHERE F.Cpe < 60 AND ((F.IdPersonaje = 233) OR (F.IdPersonaje = 234)) AND F.IdColaborador = C.Id AND F.IdPersonaje = P.Id AND F.Id NOT IN (SELECT TOP 0 F.Id FROM Fotos F, Usuarios C, Personajes P WHERE F.Cpe < 60 AND ((F.IdPersonaje = 233) OR (F.IdPersonaje = 234)) AND F.IdColaborador = C.Id AND F.IdPersonaje = P.Id ORDER BY F.Fecha DESC, F.Nombre DESC, F.Id DESC) ORDER BY F.Fecha DESC, F.Nombre DESC, F.Id DESC) ORDER BY F.Fecha DESC, F.Nombre DESC, F.Id DESC" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|
|
|