Thank you Igor and Dan. Now I am clear about the concept.

On Sat, 28 Feb 2009 20:07:45 +0530, Dan <danielk1...@gmail.com> wrote:

>
> On Feb 28, 2009, at 8:44 PM, Lloyd wrote:
>
>>
>> Hi,
>>
>> When we create a view what happens internally in sqlite? Does it
>> select
>> all the data from the table and then "insert" it in to the view? or
>> would
>> the records in the view keep references to records in main table?
>> just to
>> know whether creating more views on a big in-memory database would
>> require
>> more memory.
>
> A view in SQLite is just a SELECT statement that is saved in the
> database
> schema. If you do:
>
>    CREATE VIEW v1 AS SELECT * FROM t1;
>    SELECT * FROM v1;
>
> The SQL compiler (the thing that runs when you call
> sqlite3_prepare_v2())
> converts the select statement to "SELECT * FROM (SELECT * FROM t1)"
> before compiling a prepared statement to implement the query.
>
> So adding a view doesn't require a huge amount of extra memory.
>
> Dan.
>
>
>>
>>
>> Thanks,
>>   Lloyd
>>
>> ______________________________________
>> Scanned and protected by Email scanner
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



______________________________________
Scanned and protected by Email scanner
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to