#1 2011-06-20 15:29:25

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Passing large blob data

Hi Arnaud,

Performance-wise, what's the best way to pass TSqlRecord derived object with large blob data, say 10 MB's? The client will get large amount of blob data from the internet, and pass the data to the server which in turn save it to the DB (via your framework, of course), Q#1: is the named pipe protocol is the best choice?

I did some research, the developer of the original sqlite project suggested to design the table as such - store the blob data as the last field in the table, or even store the blob data in a separate table. Others said that increasing the page size of the DB will help in performance.

Q#2: Any other hints you can offer?

Thanks!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2011-06-20 15:37:12

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Passing large blob data

the background: I'm designing a DB to store millions of objects of different structure, so to make things simplified, the DB will only have two types of objects, or in other words, two tables:

TMyDocument = class(TSQLRecord)
  PrimaryKey: Integer; //primary key of the object
  MetaDataAsJSON: RawUTF8; //object properties in JSON format.
end;

//store blob datas of TMyDocument, can have many instances that are associated with TMyDocument.
TMyBlob = class(TSQLRecord)
  PKey: Integer;//primary key
  FKey: Integer;//foreign key, maps to TMyDocument.PrimaryKey
  MetaDataAsJSON: blob;//blob data, I still don't know what data type to use here, but you should get my point.
end;

Last edited by edwinsn (2011-06-20 15:39:18)


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2011-06-20 17:42:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,235
Website

Re: Passing large blob data

See the documentation, about BLOB data.

1. You'll have to define the BLOB fields as TSQLRawBlob
2. Let the default Blob retrieval setting, i.e. retrieve BLOB explicitely
3. Use RetrieveBlob() and UpdateBlob() methods

You have a good example of handling BLOB data in the main SynFile demo.

See the corresponding source code and the associated pages in the documentation (SAD document).

Offline

#4 2011-06-21 01:56:58

edwinsn
Member
Registered: 2010-07-02
Posts: 1,215

Re: Passing large blob data

Hi Arnaud,

Thank you very much. That helps.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB