Re: Slow Query when Prompts enabled
- From: Ronald_L <RonaldL@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Sep 2006 13:03:02 -0700
What does this mean.
Currentdb.QueryDefs("qsptYourPT").SQL
"Duane Hookom" wrote:
This is happening because you are setting a criteria on a field from a view..
Views aren't normally indexed so you are probably performing a tablescan on
your server through your Access frontend. The same would happen if you
change your parameter prompt to a reference to a control on a form.
That is why I suggest you create a pass-through query to your database
server and change the SQL property as needed. You may be wise to create a
stored procedure on your server that accepts the [FN] as a parameter. Your
P-T query SQL would then be
EXEC spYourStoredProcedure 'Jerry'
You could easily use DAO to change the SQL property to add a parameter to
match user input into a text (or combo) box.
--
Duane Hookom
MS Access MVP
"Ronald_L" <RonaldL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2074AC7D-59FE-422D-A97F-927ECFC5996A@xxxxxxxxxxxxxxxx
All of the tables are indexed via iFolder. This slowness is only an issue
when I pass the query its criteria via Prompts. If I type in the query
criteria manually, the query runs in about 3 seconds parsing approx
300,000
records.
I set just the query to prompt me for 1 thing [FN], and then it takes
forever for the query to return the results. Why is this happening.
"Jerry Whittle" wrote:
1. Are the various ifolder fields indexed in the tables?
2. Is dbo_vDocPrincipal.PrincipalFirstName indexed?
3. You haven't defined the parameter datatype. Your first line of the SQL
should look something like:
PARAMETERS [FN] Text ( 255 );
Noticed the trailing semicolon.
4. Any time that you do a Distinct expect a performance hit. That you
need a
distinct leads me to believe that you have a normalization problem. Also
the
Legal1, Legal2, etc.
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
"Ronald_L" wrote:
I have a query that is very slow, 5minutes+ to run when I have any of
the
fields prompted for information. If I type in the criteria in the
Criteria
Field the report runs in about 3 seconds or less. I am using [FN] as
the
prompt. Why would this be happening.
Here is the SQL view that is so slow
SELECT DISTINCT dbo_Folder.sTtlFldr,
dbo_vDocPrincipal.PrincipalFirstName,
dbo_vPrincipal.lastname, dbo_vPrincipal.cparty, dbo_vProperty.tAddress,
dbo_vProperty.City, dbo_vProperty.State, dbo_vProperty.County,
dbo_vProperty.Legal1, dbo_vProperty.Legal2, dbo_vProperty.Legal3,
dbo_vProperty.Legal4, dbo_vProperty.Legal5, dbo_vProperty.Legal6
FROM ((dbo_Folder LEFT JOIN dbo_vPrincipal ON dbo_Folder.iFolder =
dbo_vPrincipal.ifolder) LEFT JOIN dbo_vProperty ON dbo_Folder.iFolder =
dbo_vProperty.iFolder) LEFT JOIN dbo_vDocPrincipal ON
dbo_Folder.iFolder =
dbo_vDocPrincipal.iFolder
WHERE (((dbo_vDocPrincipal.PrincipalFirstName)=[FN]));
- Follow-Ups:
- Re: Slow Query when Prompts enabled
- From: Duane Hookom
- Re: Slow Query when Prompts enabled
- References:
- Re: Slow Query when Prompts enabled
- From: Duane Hookom
- Re: Slow Query when Prompts enabled
- Prev by Date: Re: ## conditional expression
- Next by Date: Re: Pass Through Query Error
- Previous by thread: Re: Slow Query when Prompts enabled
- Next by thread: Re: Slow Query when Prompts enabled
- Index(es):
Relevant Pages
|