A trivial example of what I'm trying to do. Given

select * from AwfyBigTbl where ACol=?;

I'd run the query

select RowID from AwfyBigTbl where ACol=?;

step through the records and store the values in a std::vector<int64_t>
called ID.
I could then retrieve n records starting at TopRecNo (0 based) with the

select * from (select Value from carray(ID+?1, ?2, 'int64'))
inner join AwfyBigTbl on AwfyBigTbl.RowID = _Value;

by setting ?1 = TopRecNo and ?2 = n.

I realise I could get the same result with

select * from AwfyBigTbl where ACol=? limit n offset TopRecNo;

but the first way will be faster and, as the record count - ID.size() - is
known , it would allow a
record counter to be shown, vertical scrollbar to be sized, last known
record to be relocated etc.

Anyway, what I'm trying to do is find a way of doing the same thing for more
queries. Given a select where a 'base table' is attached to lookup tables
how can I determine which of the lookup tables can be removed from the table
such that

select BaseTbl.RowID from ... where ... order by ...

will find the set of records that represents the original query.

Hope that's clearer.

Sent from: http://sqlite.1065341.n5.nabble.com/
sqlite-users mailing list

Reply via email to