vendredi 28 août 2015

Same query executed on the same program with different frameworks (c#) has an huge different execution time

So, I'm migrating a C# application from framework (3.5) (Visual Studio 2008) to framework (4.5.1) (Visual Studio 2013). We are using SQLite database and upgraded the entity framework to 6.1.3 and SQLite references to the ultimate (1.0.98). After some predicted problems solved and others not so predicted, I got stuck at this one. I have a query executed at code side that has different execution times between the two frameworks and unfortunately, the new one has worst results. At the old one (3.5) the execution time it's about 2-3 secs and in the new one it's almost 2 minutes. I guarantee that the DB is the same and always have the same data volume.

There's another thing...If I execute the query directly on the SQLite, the execution time it's like on the framework 4.5.1 (almost 2 minutes). How is it possible that it takes more time on SQLite than on the old app?

I create two dummy projects (one for each framework) to ensure that it is nothing that I lost on the migration but the results still the same.

It's definitely something with the old framework. My theory is that some DB parameter has being sent on the old app that turns the query more efficient but I can't find which one.

To run the query I'm using the following commad:

SQLiteCommand.Execute(query, SQLiteExecuteType.NonQuery, "MyConnectionString", new object[] { });

(the same on the two apps)

And if it is necessary I can add an example of the query.

If you know some DB profiler for free that I can use it will help a lot.

Hope someone can help!

Best Regards

Aucun commentaire:

Enregistrer un commentaire