Subject Re: [firebird-support] Re: Automatic Firing of Query.
Author Jesus Garcia
2017-08-17 16:19 GMT+02:00 anshuman.nanda@airtelmail.in [firebird-support] <firebird-support@yahoogroups.com>:
 

Yes Jesús, we are using ibx.


Can u please share the details with me.   Of share the modified file if possible.  

I have modified IBDatabase.pas. There is some checks that calls add_node to get information from system tables. I don't need this information in my applications, and I don't see it necessary to justify the overhead of calls to system tables.
These three methods calls to add_node, that create a lot of queries when datasets are opened. These queries are executed only one time, because the information that load is cached. After this changes you will see and speed up when opening datasets.

function TSchema.Has_COMPUTED_BLR(Relation, Field: String): Boolean;
var
  FRelationList : TStringList;
  FField : TFieldNode;
  i : Integer;
begin
   Result := False;
   exit;
  i := FRelations.IndexOf(Relation);
  FField := nil;
  if i >= 0 then
  begin
    FRelationList := TStringList(FRelations.Objects[i]);
    i := FRelationList.IndexOf(Field);
    if i >= 0 then
      FField := TFieldNode(FRelationList.Objects[i]);
  end
  else
    FField := Add_Node(Relation, Field);
  if Assigned(FField) then
    Result := Ffield.COMPUTED_BLR
  else
    Result := false;
end;

function TSchema.Has_DEFAULT_VALUE(Relation, Field: String): Boolean;
var
  FRelationList : TStringList;
  FField : TFieldNode;
  i : Integer;
begin
  Result := False;
  exit;
  i := FRelations.IndexOf(Relation);
  FField := nil;
  if i >= 0 then
  begin
    FRelationList := TStringList(FRelations.Objects[i]);
    i := FRelationList.IndexOf(Field);
    if i >= 0 then
      FField := TFieldNode(FRelationList.Objects[i]);
  end
  else
    FField := Add_Node(Relation, Field);
  if Assigned(FField) then
    Result := Ffield.DEFAULT_VALUE
  else
    Result := false;
end;

function TSchema.In_Key(Relation, Field: String): Boolean;
var
  FRelationList : TStringList;
  FField : TFieldNode;
  i : Integer;
begin
  Result := False;
  exit; //
  i := FRelations.IndexOf(Relation);
  FField := nil;
  if i >= 0 then
  begin
    FRelationList := TStringList(FRelations.Objects[i]);
    i := FRelationList.IndexOf(Field);
    if i >= 0 then
      FField := TFieldNode(FRelationList.Objects[i]);
  end
  else
    FField := Add_Node(Relation, Field);
  if Assigned(FField) then
    Result := Ffield.In_Key
  else
    Result := false;
end;