I've written a query to pull data from a SQL Mobile database which seems to completely hang the device when I run it (I waited several minutes before warm-starting). Yes, it's a bit complex, but it works fine on the desktop version--completes pretty much instantly.
Are there any limits to SQL Mobile that might prevent me from writing such a query There are not very many records in any of the tables (all are <20, except one which is ~2500).
Here is the query:
------------------------------------code---------------------------
SELECT
oi.ProductID, g.GenusName, Species.SpeciesName, f.FormName, f.Abbr, sz.Sizes, su.SizeUnits, su.Abbr, pa.PackageName, pa.Abbr, oi.NumRequested, oi.NumProvidedFROM OrderItems oi
JOIN
Products p ON p.ProductID=oi.ProductIDJOIN
Varieties v ON p.VarietyID = v.VarietyIDJOIN
Genus g ON v.GenusID=g.GenusIDJOIN
Species ON v.SpeciesID=Species.SpeciesIDJOIN
Grades gr ON gr.GradeID=p.GradeIDJOIN
Form f ON gr.FormID=f.FormIDJOIN
SizeUnits su ON gr.SizeUnitsID=su.SizeUnitsIDJOIN
Sizes sz ON gr.SizeID = sz.SizeIDJOIN
Packages pa ON p.PackageID=pa.PackageIDWHERE
oi.OrderID=3------------------------------------------code---------------------------------------
Any ideas Thanks in advance.
-Kevin

SQL Mobile query hangs PPC 2003 device
Winterchill
I did not try it on another device. I'm populating my .sdf database using rda.pull's of each of the tables in question. When I run the query using SQL 2005 Management Studio on the original (master) database, it completes right away. I will give it a whirl on the emulator to see what happens.
I haven't tried moving the files to a storage card--I have 20 Mb of free memory on my device (far more than on my card) and the database is only ~400kB in size. Surely that is enough...
-Kevin
SmithaNarreddi
Doesn't explain the problem though...
-Kevin
J. Aldrin
Thank you Syed--it looks like I have some learning to do. I will pursue this.
-Kevin
jesse_j3000
SQL Mobile includes support for showplans, which help assess and optimize queries.
Copy the .sdf file to desktop and open a connection from SQL 2005 Management Studio, run the query and generate a showplan. You may add indexes to the tables and explore the showplan.
Take a look at the "Query Performance Tuning" topic in SQL Mobile Books Online.
Thank you!
Syed N. Yousuf
Microsoft Developer Support Professional
This posting is provided “AS IS” with no warranties, and confers no rights.
Gerhard Zehetbauer
Just to verify - does it work OK on another device or when connecting to this .sdf database from SQL 2005 Management Studio
Have you tried moving the .sdf and Temporary Database (Temp File) to a storage card How much free space is available on the device
Thank you!
Syed N. Yousuf
Microsoft Developer Support Professional
This posting is provided “AS IS” with no warranties, and confers no rights.