I have a form that has two subforms. Right now, the main form opens very slowly. I believe the reason is the two subforms. My question is, is it faster to load all records without filtering them, or to use a query to filter down records so that only "Active" records are shown? Right now, the subforms are based on queries that have no WHERE clause. In each of the tables, there is a field that is filled in last which if populated, would mean that the user won't need to handle that record anymore. I could test to see if that field is null = true. I just don't know if this increases or decreases the load on the database.
How do I speed up my database?
Collapse
X
-
Tags: None
-
I guess I could test it. The only problem is right now I only have test information and not a lot of that so it may be hard to tell the difference.
What is an optimized/unoptimized filter?Comment
-
Well, it's more a scale of optimization.
Matching an exact value is quicker than matching a partial value.
Filtering on numbers is quicker than strings.
In is quicker than not in.
Indexed is faster than not indexed.
Fully covered index is faster than partial index.
Et cetera.
There's a lot of factors that affect the speed of a filter. In your case, you're just filtering on an exact value so I don't expect that to take too long.
However, this may all be moot. You said it's just test data and not a lot at that. I suspect then that it is not the amount of records that's slowing down the loading of the subform. It's likely to be caused by something else.Comment
-
Good point. I guess I was more worried about it slowing down even more once more data was put into it.
I assume thatCode:IsNull(DateCompleted) = True
Comment
-
By in is quicker than not in, I meant this:
Code:field1 In (1,2,3,4) field1 Not In (1,2,3,4)
Code:DateCompleted Is Null
Comment
-
Code:[DateCompleted] Is Null
([DateCompleted] Is Null) = True
, which is the actual equivalent of your suggestion).
As Rabbit's already indicated, checking fields from an index is going to be faster than those that aren't from an index. This is true regardless of the checks you use.Comment
-
Okay. I will test my database to see which things I can do to speed it up (or keep it from getting slower). Thanks for pointing out things to look for.Comment
-
Comment
-
Does code that isn't run make any difference? I have none or almost no code that runs on the opening of the form and subforms.Comment
Comment