Reputation: 121
In my database having huge data (megabytes of data).they are all images (url) .how we could display that data in mobile phones(android,iPhone). what is the better way to get that data ?i mean how to improve performance while displaying all data?
pleas tell me .
Upvotes: 0
Views: 211
Reputation: 183
If you get only images URL from database than use NSThread to call other function in i phone,It will load images in background and your apps will give you better performance.
Upvotes: 1
Reputation: 1397
You have already did a right job by just storing the required URLs in DB, with out overloading the DB with image binaries. Apart from that if you want to increase performance you can perform
1) indexing - An index is simply a data structure that provides a fast access path to rows in a table based on the values in one or more columns (the index key). This allows for fast search techniques to be used to find the values ,rather than having to scan the entire table row by row, which results in much faster data retrieval. This can be a big performance booster in your environment, lowering the amount of time it takes to run a SELECT query and get data back.
2) Hosting your images on platforms like Amazon S3 will result in faster load times, which will definitely boost performance.
Upvotes: 0
Reputation: 18440
What I understand from your question that the database contains only image URL not actual image binary data. correct?
If that is the case, I would assume you want retrieve the image URL from the database and then fetch the actual image from Internet.
Consider caching of images that will be most likely viewed by the user or even you can pre-fetch them in a background service.
When display them, definitely you need a dedicated thread so your app remains responsive.
Upvotes: 0
Reputation: 7708
The solution depends on whether your db is static or dynamic. In case the entire data is static I would zip it into the Assets folder of Android and use it directly from there avoiding any network issues whatsoever.
In case this is dynamic, you will have to create web services which only fetches those data that are visible in a specific view or fetch all data in the beginning and only do delta sync later on.
Upvotes: 0
Reputation: 211560
There's many reasons why people say not to put large binary objects in a database and this is one of them.
The database is not and never will be a filesystem. It is for storing relational data, not binary data. There are other database platforms that work as a document store, which is what you need here.
At some point you will need to back up your database and if it is hundreds of GBs in size that will prove difficult and CPU intensive. Restoring will take even longer. This kind of thing would be trivial to do with rsync
and a bit of scripting if they were all ordinary files.
My advice is to either leverage an existing solution like Amazon S3, or to store file paths in your database and serve up the files as you would any other static files, simply by having them available at a public URL. If you need a degree of security, it's usually sufficient to wall off that content by having the URL randomized sufficiently as most mobile applications don't use sessions or cookies effectively.
Upvotes: 0