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: 
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.
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.

If that doesn't help, perhaps the web.config section is locked down, and you will then have to ask your hosting company to allow the section.