Subject Re: [IBO] Re: Firebird 3 and Blob Fields with IBO !
Author Carlos H. Cantu
Re: [IBO] Re: Firebird 3 and Blob Fields with IBO ! First, keep in mind that transferring blobs with Firebird is slower than transferring other kind of fields. This is because FB requires extra calls to retrieve the blob content. In a local network, this is mostly not noticed, but if you are connecting to a remote DB over a high latency network (aka. Internet), the performance will suck when you retrieve the blob content.

Second, probably IBExpert is not retrieving the blob content automatically. Maybe it only does that when you click somewhere to actually "see" the content of the blob. Also, IBExpert usually doesn't fetch all the records at once, it does some pagination while you scroll trough the data.

Afaik, IBO retrieve the blob content only when the data is required by you (in code) or by some of the visual components. When you use Fields[x].asString, you are actually asking IBO to get the field content, transferring it from the server to the client.

[]s
Carlos H. Cantu
eBook Migration Guide to FB 3 -
www.firebase.com.br/guiafb3.php
www.FireBase.com.br - www.firebirdnews.org - blog.firebase.com.br





---In IBObjects@yahoogroups.com, <nimajo65@...> wrote :

Hi Antonio,
 
That’s a very good point by Jason.
I also want to add to what Jason says that if you don’t have any parameters in your query you can also skip the explicit Prepare since First is doing that if needed.

Ok, I removed the Prepare and First.
 
In my experience using TIB_Cursor is extremely fast and very well suited for what I think you are doing.
 
Two things come to my mind.
 
1. It’s hard to even guess what happens in AddBiometria and ConverteBiometria perhaps you are doing something there that takes time.

If I remove AddBiometria and ConverteBiometria does not change the performance. The IB_Cursor is fast, it's true. But if comment both functions and I put Fields[1].Asstring the performance is slow down. I Noted that poor speed is when the blob need be loaded. Without assign to any variable, just only load.

 
2. How are you executing the query in IBExpert?
Make sure that you are comparing apples with apples and not apples with pear by for instance check the settings for “Show text blobs as memo”.
Also, if using “SQL Editor” and you haven’t enabled “Fetch All” and are doing a simple “Execute (F9)” then only the necessary records to fill the grid are fetched, try with “Execute and fetch all (Shift+F9)” and see if there is a difference in performance.

The performance was the same, I'm using remote connect to both applications.

/Magnus


---In IBObjects@yahoogroups.com, <jason@...> wrote :

Part of it could be that you are calling Open and then First, which with a unidirectional cursor, calling the First method closes, if open, and then reopens the cursor.  That's the only way a unidirectional dataset can know it is on the first record.
 
Perhaps you could be more descriptive about what part of the whole process is slow?
 
Jason Wharton
wwww.ibobjects.com
 


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Monday, March 11, 2019 10:36 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Firebird 3 and Blob Fields with IBO !

 
Hello,

Could someone show me how to better way of the load with blob Field sub_type 0 ? for example. I have a table with just only 3 fields and 6220 records:

ID INTEGER
TEMPLATE BLOB SUB_TYPE 0
FINGER INTEGER

When I do a query on IBEXPERT is impressive the speed, the result set time is:

Plan
PLAN (ASSOCIADO_BIOMETRIA NATURAL)

------ Performance info ------
Prepare time = 741ms
Execute time = 60ms
Avg fetch time = 5,00 ms
Current memory = 11.439.512
Max memory = 16.698.304
Memory buffers = 2.048
Reads from disk to cache = 0
Writes from cache to disk = 0
Fetches from cache = 2.125

But when I use IBO to load records with Blob Field it's very slow, there are  workaround ?


  with IB_Cursor_Biometria do
  try
    SQL.Clear;
    SQL.Add('SELECT MATRICULA, DIGITAL_TEMPLATE, DIGITAL_DEDO FROM ASSOCIADO_BIOMETRIA ORDER BY DIGITAL_DEDO DESC, MATRICULA');
    Open;
    Prepare;
    First;

    while not eof do
    begin
      AddBiometria(Fields[0].AsString, ConverteBiometria(Fields[1].AsString), Fields[2].AsInteger, True, True);
      Next;
    end;
  finally
    Free;
  end;

Thanks in advance,

Antonio.