First, connect to your db file. As this is the first connection this will be
referred as 'main'.

Then you need to attach a memory database.
ATTACH DATABASE ":memory:" AS mem;

Create your table definitions in memory, por example:
CREATE TABLE mem.table1 (...
You can get some info from:
SELECT sql FROM sqlite_master WHERE type='table'

Now, to you need to something like this:
INSERT INTO mem.table1 SELECT * FROM main.table1;
This will insert all rows from table1 of your db file to memory db.

You can create any index you need on memory, but i think will not make any
difference in a memory db.
CREATE INDEX memory.IDX_TABLE1_NAME ON TABLE1(table1_name);

Summing up:
Connect to a db file, attach a memory bd, create table definition for memory
bd, do INSERT INTO ....SELECT, create index.



On 8/10/06, Manzoor Ilahi Tamimy <[EMAIL PROTECTED]> wrote:

Hi All,

Can someone give me the code you use to attach a database.
I have a db file with 5 Million records and have three different tables.
Index is also created in it.

I want to load it in memory to apply some queries for testing.

Best regards,

Manzoor Ilahi Tamimy




--
Pablo

Reply via email to