开发者

Empty tables size in sqlite db

开发者 https://www.devze.com 2023-02-14 04:19 出处:网络
I am creating a db for my android app which requires different tables for different types of users. Basically, if user type A logs in he will use Table A, user type B logs in he will use Table B and s

I am creating a db for my android app which requires different tables for different types of users. Basically, if user type A logs in he will use Table A, user type B logs in he will use Table B and similarly Table C.

Should I go ahead and create 3 tables and use only the table which the user type has logged in? Would this have any significant memory implications (size of the db)? That is, if the table doesn't contain data, would the sqlite db still allocate some space (other than for definitions of the columns).

The other way would be to check the user type and dynamically create the table at runtime once user logs in. I prefer the first method if there isn开发者_高级运维't much space used.

Any pointers or suggestions would be very useful.


The SQLite DB will occupy some space to store the table structures and the constraints/indexes. Why don't u just create the database tables (w/o any data) using SQLite Browser and check the size of the database file.

Would help you decide.


I think instead of creating all tables at one go use SQL queries to create tables as and when needed. If its not needed anymore you can even drop the table.

0

精彩评论

暂无评论...
验证码 换一张
取 消