SQLlite blocking G120 for 5 sec

I am not sure if someone have experienced this.
When I insert anything to sqllite the system becomes non-responsive for ~5 seconds, even if it is running in a different thread.

It is not good from a user experience point of view. Is there any way to get around the issues.

Internal calls block the system, this included calls to sqlite. your database very large? Maybe break into individual databases? What about ram database, still causes delays?

This happens even if only 10 entries in the table.

Only 4 data base fields are there

BTW: How much time does it take for anybody? with small databases

@ microt - A very quick and dirty test on a CobraII


    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        Database db;
        private String dbFile;
        int openCount = 0;
        Boolean autoOpened;
        GT.Timer addItems;

        void ProgramStarted()
        {
            Debug.Print("Program Started");

            if(Mainboard.IsSDCardMounted)
            {
                dbFile = Mainboard.SDCardStorageDevice.RootDirectory + @ "\testDB.sql";
                if (File.Exists(dbFile))
                    File.Delete(dbFile);
                CreateDatabase();
            }
        }

        void CreateDatabase()
        {
            if (Open())
            {
                db.ExecuteNonQuery("CREATE Table TestEvent (TestEvent_id INTEGER PRIMARY KEY, Number INTEGER, DateTime INTEGER, Event TEXT, Height TEXT)");
                addItems = new GT.Timer(2000, GT.Timer.BehaviorType.RunOnce);
                addItems.Tick += addItems_Tick;
                addItems.Start();
            }

        }

        void addItems_Tick(GT.Timer timer)
        {
            if(Open())
            {
                DateTime start = DateTime.Now;

                for(int i = 0; i < 10; i++)
                {
                    db.ExecuteNonQuery("INSERT INTO TestEvent (Number, DateTime, Event, Height) VALUES (" + i.ToString() + ", " + (start.Ticks / 1000).ToString() + ", 'Test','LOW')");
                }
                Debug.Print("Took : " + (DateTime.Now - start).ToString());
            }

        }
        public Boolean Open()
        {
            Boolean openSuccess = false;
            try
            {
                openCount++;
                if (db == null)
                {
                    db = new Database(dbFile);
                    autoOpened = true;
                }
                openSuccess = true;
            }
            catch (Exception Ex)
            {
                Debug.Print("\n");
                Debug.Print("-----------------------> " + Ex.Message + " <------------------------------------");
            }
            return openSuccess;
        }

        public void Close()
        {
            openCount--;
            if (openCount == 1)
            {
                if (db != null)
                {
                    db.Dispose();
                    db = null;
                    autoOpened = false;
                }
            }
        }



Took : 00:00:00.8719637