realbasic-nug
[Top] [All Lists]

Re: Memory usage and speed of REAL SQL database

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Memory usage and speed of REAL SQL database
From: Charles Yeomans <charles at declareSub dot com>
Date: Sat, 29 Jul 2006 13:29:58 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <3ad dot 6908411 dot 31f2bc65 at aol dot com>

On Jul 21, 2006, at 7:25 PM, GAmoore at aol dot com wrote:

1) If I use "Project -> Add -> Database -> New REAL SQL database" to add a database to the project, is the entire database going to be loaded into RAM
as the program starts?

no. only an object - an empty container. to load the database into ram
requires you to actively open it, get a record set and do something with that data.


2) Do I have a way to decide whether the database is all in memory or
accessed
from the hard drive?


Its on the hard drive. Unless you manually load it into arrays.


3) Is the time to do a SELECT statement proportional to the size of the database? i.e. If a particular SELECT statement takes, say, 1 second with
20,000 rows, will it take 10 seconds with 200,000 rows? or is it
proportional
to the size of the database in MB?


A select might be ok, but sorts are never linear. if there are n records it
can take
n*n or n^(3/2) or n*ln(n). So it could go from 10 seconds to 100 seconds, in
theory.

Not quite. First, sorting times can indeed be linear. Although comparison-exchange sorts like quick sort, merge sort, etc. are known to be no better than O(N*log(N)) on average, they can have linear running time in many cases. The implementation of quicksort in my SortLibrary should be approximately linear when the size of the key set is bounded, for example. And various types of radix sorts can have linear running time.

As for database performance, you can't really learn much about performance by thought-experiment. It's reasonable to suppose that selection speed is a function of the number of rows in a table, for example, but there are so many variables of implementation that actual testing is the only way to learn anything useful.


Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>