A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
10 replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/
source | link
9 added 379 characters in body
source | link

EDIT 5

I have opened a new question since it seems that this command is the reason of the problem

SELECT @StazenoDoReal=MAX(cas) from PenData p INNER JOIN Ukazatel u ON u.IDUkazatel=p.IDUkazatel WHERE u.IDZapisovac=@IDZapisovac 

Index seek much slower with OR condition compared with separate SELECTs

EDIT 5

I have opened a new question since it seems that this command is the reason of the problem

SELECT @StazenoDoReal=MAX(cas) from PenData p INNER JOIN Ukazatel u ON u.IDUkazatel=p.IDUkazatel WHERE u.IDZapisovac=@IDZapisovac 

Index seek much slower with OR condition compared with separate SELECTs

8 added 130 characters in body
source | link

or

 SELECT min(cas) from PenData p WHERE IDUkazatel=24 OR IDUkazatel=25 OR IDUkazatel=26 OR IDUkazatel=97 OR IDUkazatel=97 OR IDUkazatel=98

then it takes long time and memory allocation goes up steeply. Nevertheless the following commandcommands, that doesdo the same thing, isare executed in an instant and no memory allocation!!

 SELECT min(cas) from PenData p WHERE IDUkazatel=24 OR IDUkazatel=25 OR IDUkazatel=26
SELECT ORmin(cas) IDUkazatel=97from ORPenData IDUkazatel=97p ORWHERE IDUkazatel=98IDUkazatel=25
...

then it takes long time and memory allocation goes up steeply. Nevertheless the following command, that does the same thing, is executed in an instant and no memory allocation!!

 SELECT min(cas) from PenData p WHERE IDUkazatel=24 OR IDUkazatel=25 OR IDUkazatel=26 OR IDUkazatel=97 OR IDUkazatel=97 OR IDUkazatel=98

or

 SELECT min(cas) from PenData p WHERE IDUkazatel=24 OR IDUkazatel=25 OR IDUkazatel=26 OR IDUkazatel=97 OR IDUkazatel=97 OR IDUkazatel=98

then it takes long time and memory allocation goes up steeply. Nevertheless the following commands, that do the same thing, are executed in an instant and no memory allocation!!

SELECT min(cas) from PenData p WHERE IDUkazatel=24 
SELECT min(cas) from PenData p WHERE IDUkazatel=25
...
7 deleted 189 characters in body
source | link
6 added 160 characters in body
source | link
5 added 160 characters in body
source | link
4 added 581 characters in body
source | link
3 added 1311 characters in body
source | link
2 added 116 characters in body; edited title
source | link
    Post Migrated Here from stackoverflow.com
1
source | link