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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 I need a speed query to paginate a lot of pictures

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=true

THANKS 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

Posted - 2006-12-21 : 08:17:12

http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-21 : 08:25:28
Already answered here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76600&SearchTerms=spanish,webdeveloper


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -