Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Large Blob's in EDB
Sat, Apr 4 2009 11:40 AMPermanent Link

Uli Becker
Hi,

I am storing files in a blob-field of a table. With big files there are
some problems and I need your help.

I played around with the BlobBlockSize value, finally I set it to 16344;

Trying to save a photoshop-file of about 200 MB it takes about 5 seconds
to save it, but about 40 seconds to read and save it. Maybe the code I
am using is not the best:

    AttachmentStream := TEDBBlobStream.Create(dm.FilesTableBinary, bmread);
    try
      FileStream := TFileStream.Create(FullTempPath, fmCreate);
      try
        FileStream.CopyFrom(AttachmentStream, 0);
      finally
        FileStream.free;
      end;
    finally
      AttachmentStream.free;
    end;


Is there a chance to save the blob to a file in a faster way?

BTW: After saving the 200 MB blob-field and opening the table in
EDBManager it takes about 1 minute to show the table. Looked like it
crashed but it didn't. What does EDBManager do when listing the blobs?

Uli
Sat, Apr 4 2009 12:08 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli


Which bit of your code takes the time - is it generally spread or is it just one line taking the time?

In EDBManager there are options that affect the display of blobs & clobs (Explorer | Preferences | Data View) my guess (and it is a guess) is that rather than just indicating there's something in the blob field EDBManager is trying to generate a glyph it can display.

Roy Lambert [Team Elevate]
Sun, Apr 5 2009 2:19 AMPermanent Link

Uli Becker
Roy,

> Which bit of your code takes the time - is it generally spread or is it just one line taking the time?

It's this line:
AttachmentStream := TEDBBlobStream.Create(dm.FilesTableBinary, bmread);

> In EDBManager there are options that affect the display of blobs & clobs (Explorer | Preferences | Data View) my guess (and it is a guess) is that rather than just indicating there's something in the blob field EDBManager is trying to generate a glyph it can display.

Oh, good. I didn't know these options.

Uli
Sun, Apr 5 2009 5:00 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli


I don't know if it will work (I've used it with DBISAM but not ElevateDB) or if it will be faster but try

TMemoField(yourfield).LoadFromFile

Roy Lambert [Team Elevate]
Sun, Apr 5 2009 5:54 AMPermanent Link

Uli Becker
Roy,

> TMemoField(yourfield).LoadFromFile

It's a blob, not a clob.

In this case it's a photoshop-file (*.psd) which is stored in a
blob-field in my table. I just want to extract and ope the file with
photoshop.

Uli
Sun, Apr 5 2009 7:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli

>It's a blob, not a clob.

In that case try TBlobField

>In this case it's a photoshop-file (*.psd) which is stored in a
>blob-field in my table. I just want to extract and ope the file with
>photoshop.

I thought you were trying to read from disk and store in the table. To extract to disk why not just use the SaveToFile method?

Roy Lambert [Team Elevate]
Sun, Apr 5 2009 7:57 AMPermanent Link

Uli Becker
Roy,

> I thought you were trying to read from disk and store in the table. To extract to disk why not just use the SaveToFile method?

You are right - that is much simpler than my code (didn't know this
way). But the performance is the same. It takes nearly one minute for a
200 MB file.

Uli

Mon, Apr 6 2009 7:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< Trying to save a photoshop-file of about 200 MB it takes about 5 seconds
to save it, but about 40 seconds to read and save it. Maybe the code I am
using is not the best: >>

CopyFrom uses an approximate buffer size of 64k, so it should be optimal in
terms of copying the BLOB.  I'll have to check this out here with a very
large file and see if I can reproduce it.

<< BTW: After saving the 200 MB blob-field and opening the table in
EDBManager it takes about 1 minute to show the table. Looked like it crashed
but it didn't. What does EDBManager do when listing the blobs? >>

As Roy indicated, the slowdown is due to the Column Details/Size display in
the grid.  You can turn it off in the Preferences dialog under Data View.
The options that you want are:

Show BLOB Column Data = Unchecked
Show BLOB Columns = Unchecked

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Apr 7 2009 2:39 AMPermanent Link

Ulrich Becker
Tim,

> CopyFrom uses an approximate buffer size of 64k, so it should be optimal in
> terms of copying the BLOB.  I'll have to check this out here with a very
> large file and see if I can reproduce it.

OK, thanks.

> Show BLOB Column Data = Unchecked
> Show BLOB Columns = Unchecked

I simply didn't know these options. Works fine now.

Uli
Image