开发者

Performance of SQLite database with too many columns

I am developing an iOS application, and the performance is really important for my application. It has a bookmark database that may contain up to 1000 rows, depending on the usage of each user.

Right now, each row has 10 columns and most of them are just null. So I'm wondering if it is better to group some columns into one column 开发者_如何学C(and probably use commas to separate them)? Will this improve the performance? Those columns are not indexed, so there is no problem in doing this, and they are usually read together.

Thank you very much!


1000 rows doesn't sound like alot to iterate over but every answer I tried to write was overly complicated without knowing what the columns were and why so many are null.

The best answer I can give you is no I do not think grouping columns together into a comma seperated list would help improve the performance of the database. I think you would be wrestling an alligator trying to extract the information you actually wanted.


This sounds a lot like premature optimization.

I’d say: no, unless you’re running into actual performance problems. And even then I would suggest running a profiler, to see what’s actually eating up your performance.

With 1000 rows max, using one or more columns will most likely not be your bottleneck.

In fact, chances are that multiple empty columns might be more efficient than a single non-empty column where you have to extract the different empty values from.

What kind of data is it?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜