Sorry the mail was sent prematurely. Continuing ...
2. In a loop, read each address,
                   for that address find the next time this address was used
( to implement the replacement policy)

To do this:

1. I am creating a table: CREATE TABLE AddressSet (SeqNo UNSIGNED BIG INT
PRIMARY KEY, Address UNSIGNED BIG INT)
2. Inserting all the addresses INSERT INTO AddressSet VALUES(Seqno, Address)
...

3. In the loop I am doing this (for each of the seqeunce numbers):
                      SELECT SeqNo, Address FROM AddressSet WHERE SeqNo=n ,
n = 1,2, ......   (Let the address selected be m)
                      DELETE FROM AddressSet WHERE SeqNo=n
// delete it so that for the next select statement we get the next time this
address was seen
                      SELECT SeqNo, Address FROM AddressSet WHERE Address=m
ORDER BY SeqNo ASC LIMIT 1 // here SeqNo gives us the next time this address
was seen

That is all.
Please let me know if these can be optimized somehow.

Thanks a lot for your help!
Abhisek









On Mon, Jul 18, 2011 at 10:58 AM, [email protected] <[email protected]
> wrote:

> Hi,
>
> I am a new user of SQLite and I have a series of steps to do on a single
> table, and it takes way too long. I will outline the steps below and please
> let me know if I can do anything different to speed things up a bit.
>
> So I am coding up a cache simulator. The input basically consists of a
> series of addresses:
> Seq No Address
> 1 0x124590000
> 2. 0x033333300
> ...
>
> These are addresses accessed by a program. There will be 100 billion
> entries or so like this, which makes it necessary to use the database. The
> processing is as follows:
> 1. Read the addresses into the table.
>
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to