On Wed, 19 Oct 2005, Allan, Mark wrote: >We are able to compile our application for both target and host. When >compiled for host the application runs on Win32 and will >create/read/write to a database file on the host PC. > >The performance of the deletions on Win32 will not take the 11 minutes I >specified, this is only a problem for our target. The same operation on >the PC will take only 3-4 seconds. Please note that since my first email >we have tried increasing the page size of SQLite and have increased the >page size from 1024 bytes to 8192 bytes. This has decreased the time to >process the same delete operation from 11 minutes to 3.75 minutes on our >target hardware. Both host and target versions of the software use the >same configuration a page size of 8192 bytes and a cache of 75 pages = >600k. > >The only real differences are 1) the hardware, 2) the filing system. We >would expect a difference in performance as the PC is much faster than >our target hardware and the write speed to NOR flash is comparatively >slow but not as drastic a drop-off as we see. 3-4 seconds -> 3-4 minutes.
>From the VDBE output you originally posted, you are doing a fair amount of work for each deleted row: - Index search to find the next row from EXAMINATIONS to delete - Removing the row from 3 indexes on EXAMINATIONS - (trigger) Remove related row in SPIRO_TEST from 2 indexes on SPIRO_TEST - (trigger) Remove related row in SPIRO_TEST - Remove the row from EXAMINATIONS Check your cache size. If the above work is causing the 75 page entry cache to thrash, you're likely to hit worst case performance as the thrashing pages may be being accessed in a cyclical fashion. Not sure how like it is that your page cache is not big enough. How big is a row of data, typically? Also, a 60x slowdown is not to be unexpected. The PC version, while probably having the same SQLite page cache size in the SQLite app itself, will most likely be reading and writing to the OSes cache at memory to memory copy speed most of the time, with synchronous writes only done when needed. The embedded platform you're using probably writes straight to FLASH, which is necassarily a synchronous operation if your OS doesn't have a cache between your app and the FLASH FS. While flash writes are low latency, they are also low bandwidth, and won't be within an order of magnitude of performance when compared to a desktop PC write to OS filesystem cache. Finally, you give no indication on the actual CPU speed of the embedded platform. It's quite reasonable to assume a development PC could be an order of magnitude faster on sheer integer throughput. I'm amazed how slow my 50MHz microSPARC based SPARCclassic is. Such a platform would not be much, if at all, slower than a modern embedded platform, and has the benefit of gobs of RAM, but still runs the same code two orders of magnitude slower at least than my Athlon XP 1700 based desktop. You have to keep your performance expectations realistic. You are, afterall, running a complete, ACID transaction, SQL relational database. > >It may be useful for us to know what SQLite is doing during deletion so >that we can try and optimise our code and/or any configuration of SQLite, >our filesystem code or the hardware to try and get this figure down. Can >anyone give me a reasonably detailed description of what is happening >during delete. The documentation on the website has not helped us >diagnose where our problem lies. Others have indicated that dropping indexes might help when deleting or inserting records. However, have you tried simply not having indexes at all? Would that cause unacceptable slowdown? Perhaps, for the demo query from the original post, just keep the DATE index on EXAMINATIONS, and use full table scans for queries based on EXAM_TYPE and STATUS_FLAG. Truth is, given the small number of EXAM_TYPE and STATUS_FLAG values (I presume), you're as well just doing table scans when looking for specific exam types and statuses. Indexes only really help when you have a large variation in values with few collisions. Doing this will leave a single index update in addition to the actual row removals, which should improve performance. > >Best Regards > >Mark > Christian > > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Sent: 18 October 2005 19:06 >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] Very Slow delete times on larger databases, please >help! > > >"Allan, Mark" <[EMAIL PROTECTED]> wrote: >> Have you been able to investigate this yet? > >I have investigated and I found nothing wrong. I am unable >to reproduce the problem. >-- >D. Richard Hipp <[EMAIL PROTECTED]> > > > > >DISCLAIMER: >This information and any attachments contained in this email message is >intended only for the use of the individual or entity to which it is addressed >and may contain information that is privileged, confidential, and exempt from >disclosure under applicable law. If the reader of this message is not the >intended recipient, or the employee or agent responsible for delivering the >message to the intended recipient, you are hereby notified that any >dissemination, distribution, forwarding, or copying of this communication is >strictly prohibited. If you have received this communication in error, please >notify the sender immediately by return email, and delete the original message >immediately. > -- /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \