[sqlite] Query times vary between 0.2 s and 30 s for very

2015-03-26 Thread James K. Lowden
On Wed, 25 Mar 2015 10:02:24 +
Simon Slavin  wrote:

> 
> On 25 Mar 2015, at 3:28am, James K. Lowden 
> wrote:
> 
> > Is there some lower bound on either the size of the IN list or the
> > number of rows in the table being queried?
> 
> There's nothing in the language to stop you from executing "... WHERE
> c IN (12) ..." on a zero-row table.  It won't be efficient, but it
> will give the correct result.

I guess I was unclear.  I was asking about SQLite's implementation,
specifically whether an IN clause is always sorted using an ephemeral
table, or if that complexity is subject to some minimum threshhold.  

--jkl


[sqlite] SQL Syntax To Copy A Table

2015-03-26 Thread Martin Engelschalk
Hi Nige,

create table  as select * from 

See also http://www.sqlite.org/lang_createtable.html

Martin

Am 26.03.2015 um 16:29 schrieb Nigel Verity:
> Hi
>
> I know this must seem a fairly dumb question, but I can't find an easy way to 
> create a copy of table using just SQL.
>
> My requirement is to take periodic snapshots of a names and addresses table, 
> to be stored in the same database as the master.
>
> The master table has one index - an auto-incrementing integer ID (non NULL, 
> primary key). There is no need for the corresponding field in the snapshot to 
> be indexed, but the integer ID does need to be copied across.
>
> I'm happy to copy the table structure in one operation and the data in 
> another, but if it can be done in a single operation so much the better.
>
> Thanks
>
> Nige
>
>
>   
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

-- 

*Codeswift GmbH *
Kr?utlerweg 20a
A-5020 Salzburg
Tel: +49 (0) 8662 / 494330
Mob: +49 (0) 171 / 4487687
Fax: +49 (0) 3212 / 1001404
engelschalk at codeswift.com
www.codeswift.com / www.swiftcash.at

Codeswift Professional IT Services GmbH
Firmenbuch-Nr. FN 202820s
UID-Nr. ATU 50576309



[sqlite] SQL Syntax To Copy A Table

2015-03-26 Thread Nigel Verity
Hi

I know this must seem a fairly dumb question, but I can't find an easy way to 
create a copy of table using just SQL.

My requirement is to take periodic snapshots of a names and addresses table, to 
be stored in the same database as the master.

The master table has one index - an auto-incrementing integer ID (non NULL, 
primary key). There is no need for the corresponding field in the snapshot to 
be indexed, but the integer ID does need to be copied across.

I'm happy to copy the table structure in one operation and the data in another, 
but if it can be done in a single operation so much the better.

Thanks

Nige





[sqlite] SQL Syntax To Copy A Table

2015-03-26 Thread John McKown
On Thu, Mar 26, 2015 at 10:29 AM, Nigel Verity  
wrote:
> Hi
>
> I know this must seem a fairly dumb question, but I can't find an easy way to 
> create a copy of table using just SQL.
>
> My requirement is to take periodic snapshots of a names and addresses table, 
> to be stored in the same database as the master.
>
> The master table has one index - an auto-incrementing integer ID (non NULL, 
> primary key). There is no need for the corresponding field in the snapshot to 
> be indexed, but the integer ID does need to be copied across.
>
> I'm happy to copy the table structure in one operation and the data in 
> another, but if it can be done in a single operation so much the better.

You could use _two_ statements like:

DROP TABLE IF EXISTS copy_of_bubba;
CREATE TABLE copy_of_bubba AS SELECT * FROM bubba;

>
> Thanks
>
> Nige
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



-- 
If you sent twitter messages while exploring, are you on a textpedition?

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown


[sqlite] FW: Very poor SQLite performance when using Win8.1 + Intel RAID1

2015-03-26 Thread Don V Nielsen
This discussion, and you guys, are amazing.  I am learning so much!

On Wed, Mar 25, 2015 at 8:56 PM, Keith Medcalf  wrote:

>
> On Wednesday, 25 March, 2015 10:42, Simon Slavin 
> said:
>
> >On 25 Mar 2015, at 1:47pm, Rob van der Stel <
> RvanderStel at benelux.tokheim.com> wrote:
>
> >> One open issue for me remains however. Can I assume that the
> >> FlushFileBuffers API that SQLite uses still causes cache to be
> >> written to disk even though the 'automatic write-cache flushing'
> >> of Windows is turned off ?
>
> This depends on the device itself.  Basically, one setting enables use of
> the
>
> >I can't answer your question because Windows isn't my field of expertise,
> >but you could read the section 'Write-Cache Buffer Flushing' in
>
> >
> http://www.samsung.com/global/business/semiconductor/minisite/SSD/us/html/whitepaper/whitepaper12.html
>
> Well, this is chock full of errors:
>
> Virtual Memory: In order to address any potential lack of memory capacity,
> the Windows OS automatically generates a block of virtual memory (stored in
> a hidden pagefile.sys file) on the "C:" drive. In the past, before PC
> Memory (DRAM) was available in high volume, PCs needed to utilize some HDD
> space to address any memory shortcomings. The Windows OS automatically
> reserves storage space for Virtual Memory equal to 100% of physical DRAM
> capacity (e.g. Windows will reserve 4GB of Virtual Memory for a system with
> 4GB of DRAM or 32GB of capacity for systems using a 64-bit OS and featuring
> 32GB of DRAM).
>
> is completely bogus.  A machine with 4GB of RAM and a 4GB swapfile has 8GB
> of total virtual memory.  If you change the 4GB of RAM to 8GB of RAM and
> set no swap then you will have 8GB of virtual memory.  In both cases you
> have the same amount of virtual memory available.  Turning off the swap
> file reduces the number of levels of hardware lookasides and management
> overhead that need to be done to perform V:R mapping increasing performance
> significantly.  In addition, if your pagefile size is fixed, then the
> number of pagetable entries is fixed and the amount of management overhead
> of dynamic VM size is eliminated resulting in performance about half-way
> between operating in "magical" mode (the default, where the VM size is not
> fixed) and the optimal (where there is no swapfile at all).  This applies
> mutatis mutandis no matter what size of virtual ram you are talking about.
> If you have 256 GB of RAM then there is no way that you need to have a 256
> GB swapfile (or any swapfile at all).
>  These myths started in the mid-80's when the price of RAM chips went over
> $100 per 256 kilobit and you needed to be, shall we say, rather well-to-do
> in order to have anything beyond the bare necessity of RAM.  In the modern
> era, you should simply buy sufficient RAM and do away with the archaic
> concept of a swapfile.
>
> Prefetch/Superfetch:  Windows stores common device drivers and frequently
> used applications in main memory (DRAM) in order to improve performance. By
> disabling these features, the OS can reduce system memory (DRAM) use.
> Furthermore, since SSDs have very fast data access times, these features
> are no longer really necessary. Thus, they are disabled for all profiles.
>
> is also somewhat misleading.  Superfetch moves commonly used stuff from
> "spinning disk" to Flash Storage based on the premise that "spinning disk"
> has crappy random access characteristics and Flash (even USB) is better in
> this regard, and that spinning disk has better sequential performance
> compared to that same Flash (which it does).  If the OS detects that the
> system volume is located on a volume with decent random access performace
> characteristics and decent sequential performance, then it will disable
> Superfetch for you all by itself, and ignore your attempts to re-enable it.
>
> Prefetch is somewhat different.  Prefetch is a list of dependancy and
> relocation data to allow modules to be loaded without having the loader do
> all sorts of extra work resolving linkage references and finding and
> loading dependent modules, in addition to pre-loading and relocating
> dependencies before they are requested.  It provides an advantage only if
> you have a really really really old and very very very slow computer with a
> really super slow I/O system.  The advantage declines quite rapidly and
> goes negative long before it become negligible again -- but on any modern
> computing equipment it does nothing of any significance (nor hinderance).
>
> Be careful of things that claim they "magically optimize" for you.  Often
> they don't.
>
> >Also, I like this post:
>
> >http://blogs.msdn.com/b/oldnewthing/archive/2013/04/16/10411267.aspx
>
> This guy is a Balmerite and should be shot on site (or at least put out to
> pasture like Ballmer where he can do no more harm).  Maybe you want to hide
> such things from certain classes of people.  Perhaps when Windows is first
> installed it should ask