Hello Ann, thank you for your good explanation. Now it´s clear to me what happens. I´ve created seperate indices on all three fields. It´s much quicker < 1second but not really quick. In my example there are ~7000 records for the given id and ~2000 for the given date. Firebird must calculate the intersection. It will took time. Maybe MS SQL optimize that. Interesting to see that the same code on Firebird is nearly 100 times slower.
Fortunately most of the selects i could change from BETWEEN to = so my code works quick enough. For the remaining i add seperate indices. Martin
