pnmgman Posted March 12, 2007 Posted March 12, 2007 I am hosting a database on 8.0 advanced server and whenever I use the GROUP BY clause from FMP 8 on a client PC, the server goes to 100% utilization and takes nearly a half hour to return results. Can someone tell me if this behavior is normal for FMP when using GROUP BY. I know it's the GROUP BY clause because when I remove it, the code runs fine (still slow but tolerable). I need to know how to optimize this code so that it executes within seconds or if I am SOL. Any help would be appreciated - thanks! The sql is as follows: SELECT "Asset Inventory"."ProductID", "Asset Inventory"."OrderDate","Asset Inventory"."ProductType","Asset Inventory"."MfgrID" FROM "Asset Inventory" WHERE LOWER("Asset Inventory"."ProductType") = 'software' or LOWER("Asset Inventory"."ProductType")='swflicense' or LOWER("Asset Inventory"."ProductType") = 'swflicense-server' GROUP BY "Asset Inventory"."ProductID", "Asset Inventory"."OrderDate"
The Shadow Posted March 23, 2007 Posted March 23, 2007 How does the speed change if you reduce the number of columns your grouping by? If that helps, you might try nesting the queries, where you only group a single column in each statement.
fmsavey Posted April 3, 2007 Posted April 3, 2007 One qustion one suggestion. Why are you using the group by function when you are not summarizing any columns? Always surround selection criteria "or" in the where clause with parenthesis. ie. ( a = b or c = d or e = f ). Properly placed parentheses can dramatically improve performance. Something to do with the sql execution plan I guess.
Recommended Posts
This topic is 6445 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now