Re: Performance problem in sql ce
- From: "Ginny Caughey MVP" <ginny.caughey.online@xxxxxxxxxxxxxx>
- Date: Mon, 21 Apr 2008 11:39:35 -0400
Gagan,
Just work with the result set directly - don't bother converting back and forth to a dataset. If you create an updatable result set, you can change the data in the underlying table directly without needing a dataset or data adapter at all. You just set the new values for the columns and call Update. There is also Delete and Insert if you need those methods. There are some pretty good samples in the documentation if you search under SqlCeResultSet.
For best perforumance create separate result sets for the other tables using TableDirect, specify the index name for that table and the range, which provides the filtering. This is very fast, even if there are a lot of records, because you are bypassing the query processor entirely and working directly with the indexes.
Ginny
"Gagan" <Gagan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:FC6F0AB3-F2FF-429B-B05A-6AA1A7082215@xxxxxxxxxxxxxxxx
Hi Jin,
Thanks your suggestion works i tried with this
SqlCeResultSet rs = CeCommand.ExecuteResultSet(ResultSetOptions.Scrollable);
For query, with where clause i was getting result in 1 min now i am getting
result in 10 sec. I can use this on many places to improve performance.
Previously i was using
CeDataAdapter = new SqlCeDataAdapter(CeCommand);
to fill the result in dataset.
But the problem is still same for the query which is taking > 15 min.
By saying programmatically joins means first create separate result sets for
all tables then start filtering or some thing else please clear.
Another problem is that i am using dataset every where. After getting
results for filtering, sorting and showing on UI. Can we convert result set
object to dataset directly or i have to work with resultset only. i am not
much familiar with this object and i don't have much time for r&d.
"Jin" wrote:
On Apr 21, 4:26 am, Gagan <Ga...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
> I am very disappointed with the sql queries performance in sql ce. In > my
> some queries i have inner joins on 9 tables some tables have more then > 150000
> records. Db size is around 15 MB. If i run that query with particular > where
> clause (ex RoomNo. = 100) then it gives result in 1 minute otherwise i > wait
> for 15 min. & i did not get results. However i am using proper indexing > on
> SARG still response time is not acceptable. I also tried by putting db > on sd
> card doesn't work.
> Can any body help me to find out where i am wrong or the limitations of > sql
> ce queries.
150,000 records sounds a bit too much for mobile application to
handle. Couple that with joins on 9 tables, I wouldn't expect good
performance at all. Ginny's suggestion of denormalization is a good
one if you can afford to make the changes. Another approach might be
to avoid the joins as much as possible and go with programmatic joins
via the SqlCeResultSet. This approach will at least allow you to have
a bit more control over the performance bottlenecks.
- Jin
--
Ginny Caughey
Device Application Development MVP
www.wasteworks.com
Software for Waste Management
.
- References:
- Performance problem in sql ce
- From: Gagan
- Re: Performance problem in sql ce
- From: Jin
- Re: Performance problem in sql ce
- From: Gagan
- Performance problem in sql ce
- Prev by Date: Re: Distributing SQL CE 3.5
- Next by Date: Re: Performance problem in sql ce
- Previous by thread: Re: Performance problem in sql ce
- Next by thread: Re: Performance problem in sql ce
- Index(es):
Relevant Pages
|
Loading