Question: I have this query and it's very slow. Can i write this query in other way by avoiding subselects for example?

Also i tried adding composite index on 

```
MyIndex(kategorije_id,izdvojen,izdvojen_kad,datum)

```

but it doesent use it when i explain this query so is there another index that i can use to speed up this query? 

```
SELECT artikli.datum AS brojx, artikli.izdvojen AS i, artikli.izdvojen_kad AS ii, artikli.name
FROM artikli
WHERE artikli.izbrisan =0
AND artikli.prodano !=3
AND artikli.zavrseno =0
AND artikli.od_id !=0
AND kategorije_id
IN ( 18 )
AND (
SELECT count( * )
FROM artikli_polja, polja
WHERE polja.id_kat = artikli.kategorije_id
AND artikli_polja.id_polja = polja.id
AND artikli_polja.id_artikal = artikli.id
AND polja.name = "godiste"
AND artikli_polja.valueInt >= "1993"
) >0
AND (
SELECT count( * )
FROM artikli_polja, polja
WHERE polja.id_kat = artikli.kategorije_id
AND artikli_polja.id_polja = polja.id
AND artikli_polja.id_artikal = artikli.id
AND polja.name = "godiste"
AND artikli_polja.valueInt <= "2000"
) >0
ORDER BY i DESC , ii DESC , brojx DESC
LIMIT 140 , 35

```

Answer: 
You need to tell your host to change the framework version your ***AppPool*** is tied to. Its probably tied to 2.0 which doesn't recognize system.web.extensions. It needs to be changed to 4.0

More info [here](http://blog.benday.com/archive/2010/05/19/23278.aspx) and [here](http://forums.asp.net/t/1547286.aspx/2/10)
A couple of things to try:   

If the OS is 64bit, try to recompile your application in Any to have it run as a 64bit application. Or change the Application Pool to enable 32bit applications.