Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-28 Thread Rowan Worth
? > > Does that mean anything to you? If it doesn’t I’ll make a post on the c++ > builder forum. > > > From: Rowan Worth<mailto:row...@dug.com> > Sent: 29 December 2017 03:13 > To: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org> > Subject: Re: [s

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-28 Thread x
ailing list<mailto:sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] What happens if an in memory database runs out of memory On 23 December 2017 at 00:17, curmudgeon <tam118...@hotmail.com> wrote: > >You can run tests yourself by compiling with -DSQLITE_ENABLE_MEMSYS5

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-28 Thread Rowan Worth
On 23 December 2017 at 00:17, curmudgeon wrote: > >You can run tests yourself by compiling with -DSQLITE_ENABLE_MEMSYS5 > > Is that a minus sign before the DSQLITE_ENABLE_MEMSYSS? If I try compiling > with a minus sign before that directive I get a compile error "macro

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-22 Thread curmudgeon
>You can run tests yourself by compiling with -DSQLITE_ENABLE_MEMSYS5 and then starting the "sqlite3.exe" command-line shell with the "--heap" argument to tell it how much memory to use. Give it a few megabytes. Then start up your in-memory database and fill it up to see what happens.

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-22 Thread curmudgeon
>I would think that a temp file database (created with an empty string) is no different from a regular disk file resident database EXCEPT that the file is generated with an random tmpfile name and automatically unlinked when closed, and that "memory pressure" equates to "page cache is full". I

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-22 Thread Keith Medcalf
>I thought I had posted this earlier but I don't see it. >Earlier I said the ideal solution would be something that uses memory >and defaults to disc if it runs out of memory. In response Richard's >suggested using a temp database with a blank name as that would use >memory but parts of it

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-22 Thread curmudgeon
I thought I had posted this earlier but I don't see it. Earlier I said the ideal solution would be something that uses memory and defaults to disc if it runs out of memory. In response Richard's suggested using a temp database with a blank name as that would use memory but parts of it would be

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread curmudgeon
Keith / Simon, thanks to both of you for those detailed replies but I'll need a bit of time to digest them. It may seem I'm a bit OCD trying to save a few microseconds here and there but this is to do with a thread I started a while back regarding getting a list of RowIDs pointing to the query

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread Simon Slavin
On 21 Dec 2017, at 4:34pm, curmudgeon wrote: > Put it this way, if I create n temp tables will there be n_+ 1 page caches > or just the main cache containing a further n temporary caches? Try it and see. But unless you intentionally make us strange numbers the problem

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread Keith Medcalf
>All I was able to determine was that setting temp_store = 2 (MEMORY) >did speed up the queries but I've no idea if using that setting is risky >on a lower spec pc. I "tested" this and setting temp_store to MEMORY is the same as placing the database itself in :memory:. That is, the page_cache

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread curmudgeon
>According to the documentation you quoted, >"Each temporary table and index is given its own page cache" >every temporary table gets its own cache. Each cache can grow to a maximum size of SQLITE_DEFAULT_TEMP_CACHE_SIZE . Yeah, but it also says "SQLite uses a page cache of recently read

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread Simon Slavin
On 21 Dec 2017, at 2:15pm, curmudgeon wrote: > Can someone tell me, if I create a temporary table does is its 'separate > cache' created within the cache_size cache or is it completely separate from > that? According to the documentation you quoted, "Each temporary

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-21 Thread curmudgeon
*"SQLite uses a page cache of recently read and written database pages. This page cache is used not just for the main database file but also for transient indices and tables stored in temporary files. If SQLite needs to use a temporary index or table and the SQLITE_TEMP_STORE compile-time

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-20 Thread x
Just seen this Each temporary table and index is given its own page cache which can store a maximum number of database pages determined by the SQLITE_DEFAULT_TEMP_CACHE_SIZE compile-time parameter. (The default value is 500 pages.) The maximum number of database pages in the page cache is the

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Keith Medcalf
>>Until the underlying system memory allocator fails and then it go >boom. How >much goes boom is OS dependent. Some OSes will only allow the errant >process go boom. Others (such as those from Microsoft) the entire OS >go >boom if the out of memory condition encompases the entire V=V address

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Simon Slavin
On 19 Dec 2017, at 9:22pm, curmudgeon wrote: > Thanks Keith. So sqlite does look to increase the temp table's cache size if > it's not big enough? No. Memory allocated to that cache is memory which can’t be used by anything else. There’s probably a far better use for

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread curmudgeon
>Until the underlying system memory allocator fails and then it go boom. How much goes boom is OS dependent. Some OSes will only allow the errant process go boom. Others (such as those from Microsoft) the entire OS go boom if the out of memory condition encompases the entire V=V address space.

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Keith Medcalf
, 2017 11:12 >To: SQLite mailing list >Subject: Re: [sqlite] What happens if an in memory database runs out >of memory > > > >On 19 Dec 2017, at 6:01pm, curmudgeon <tam118...@hotmail.com> wrote: > >> 1) I read in those links that each temp table is given

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread curmudgeon
>> 3) Similar to the original question, if you set temp_store = 2 (memory) and >> there isn't enough memory for the table what happens? >By 'memory' that web page is referring to whatever your operating system thinks is memory. So the >same thing happens as would happen to any application

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Simon Slavin
On 19 Dec 2017, at 6:01pm, curmudgeon wrote: > 1) I read in those links that each temp table is given (by default) its own > page cache of 500 pages. Is this a separately created page cache or is it > 500 pages from THEE page chache? If it's the latter that will explain

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread curmudgeon
Thanks Simon/Gunter. I thought those sections cleared things up until I tried a few tests. I opened the DB, set temp_store to STORE, cache_size to CACHE and then calculated the average secs taken (over 2 runs) to run the following [Tbl has integer primary key ID, contains 10,570 records & is

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Simon Slavin
On 19 Dec 2017, at 11:40am, Simon Slavin wrote: > See section 3 of > > Sorry. See section 4 too. Simon. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread Simon Slavin
On 19 Dec 2017, at 9:33am, curmudgeon wrote: > Running the same tests again using > an actual table (TEMP keyword omitted) shows the in memory INSERT (and > DELETE) to be twice as fast on the database loaded into memory compared to > when it's accessed from the SSD.The

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread curmudgeon
My apologies. The inserts in the above tests were made on a TEMP table which I assumed was being created in the existing database. I've since discovered that isn't the case. *Tables created using the "CREATE TEMP TABLE" syntax are only visible to the database connection in which the "CREATE TEMP

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-19 Thread curmudgeon
My apologies. The inserts in the above tests were made on a TEMP table which I assumed was being created in the existing database. I've since discovered that isn't the case.*Tables created using the "CREATE TEMP TABLE" syntax are only visible to the database connection in which the "CREATE TEMP

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-18 Thread x
o.za> Sent: Monday, December 18, 2017 3:19:31 PM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] What happens if an in memory database runs out of memory A big cache on an in-memory DB is a bit like insisting to sit inside a row-boat while on a big ship. It has zero effect in hel

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-18 Thread R Smith
A big cache on an in-memory DB is a bit like insisting to sit inside a row-boat while on a big ship. It has zero effect in helping you float better - it's probably slightly worse even, considering the cache computation cycles could have been avoided. To get clarity, are you saying the 33%

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-18 Thread curmudgeon
Sorry cache_size should be -8,000,000. It didn't make any difference to the results or conclusion though. -- Sent from: http://sqlite.1065341.n5.nabble.com/ ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-18 Thread Simon Slavin
On 18 Dec 2017, at 2:48pm, curmudgeon wrote: > You're definitely right about me wasting my time Simon. I loaded my entire > database (1 GB) into memory and set cache_size = -8192 for an 8 GB cache > size (using win64). I then ran my test (inserting the results of a

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-18 Thread curmudgeon
You're definitely right about me wasting my time Simon. I loaded my entire database (1 GB) into memory and set cache_size = -8192 for an 8 GB cache size (using win64). I then ran my test (inserting the results of a query, returning 111 million bigints, into a non-indexed single column table) and

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-16 Thread x
. From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of Simon Slavin <slav...@bigfraud.org> Sent: Friday, December 15, 2017 8:50:40 PM To: SQLite mailing list Subject: Re: [sqlite] What happens if an in memory database runs o

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Simon Slavin
On 15 Dec 2017, at 8:36pm, x wrote: > I’ll have to look into how to increase the in-memory pager cache. Before you do anything like that, ask yourself two questions: a) Is my program actually fast enough without any of these weird picky measures ? Or am I spending

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread x
list Subject: Re: [sqlite] What happens if an in memory database runs out of memory On 12/15/17, x <tam118...@hotmail.com> wrote: > > Is there any easy way of creating a table that will use mem for speed but > revert to disc for backup if memory runs out? > Make the database

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Richard Hipp
On 12/15/17, x wrote: > > Is there any easy way of creating a table that will use mem for speed but > revert to disc for backup if memory runs out? > Make the database filename be an empty string. -- D. Richard Hipp d...@sqlite.org

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread x
;mailto:d...@sqlite.org> Sent: 15 December 2017 19:11 To: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org> Subject: Re: [sqlite] What happens if an in memory database runs out of memory On 12/15/17, x <tam118...@hotmail.com> wrote: > Suppose I execute “attach :memory: as m

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Richard Hipp
On 12/15/17, x wrote: > Suppose I execute “attach :memory: as mem” and then create a table in mem > that requires more space than the available RAM can hold what will happen? You will get an SQLITE_NOMEM error from SQLite. This is well-tested behavior. You can run tests

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Keith Medcalf
Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Friday, 15 December, 2017 09:31 >To: sqlite-users@mailinglists.sqlite.org >Subject: [sqlite] What happens if an in memory database runs out of >memory > >Suppose I execute

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Jens Alfke
> On Dec 15, 2017, at 8:30 AM, x wrote: > > Suppose I execute “attach :memory: as mem” and then create a table in mem > that requires more space than the available RAM can hold what will happen? On most operating systems, the kernel will use virtual memory, so part of

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Simon Slavin
On 15 Dec 2017, at 4:30pm, x wrote: > Suppose I execute “attach :memory: as mem” and then create a table in mem > that requires more space than the available RAM can hold what will happen? The problem would not happen when you create the table. SQLite reserves only a

Re: [sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread Paul Sanderson
Try it create a table and use the zeroblob(n) function to insert lots of blobs of size n ie create table blobs (b blob); insert into blobs values(zeroblob(1)); insert into blobs values(zeroblob(1)); etc. interestingly the max blob size is specified as 2147483647 but on my

[sqlite] What happens if an in memory database runs out of memory

2017-12-15 Thread x
Suppose I execute “attach :memory: as mem” and then create a table in mem that requires more space than the available RAM can hold what will happen? ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org