Subject Re: [IBO] Two databases in same project
Author stanw1950
--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> > /*---
> > EXECUTE STATEMENT
> > TR_HANDLE = 14554584
> > STMT_HANDLE = 14554656
> > PARAMS = [ Version 1 SQLd 1 SQLn 1
> > [NAME] = 'RDB$PRIMARY22 ' ]
> >
> > SECONDS = 33.450
> > ----*/
>
> Please show which statement was prepared for this statement handle.
It may
> be needful for an index on the metadata to be put in place.
>
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com

Jason,

The program has two tibodatabases and two tibotables (one table for
each database). The two statements executed for the slower database
and table are:

AdaptaDB.Connected := true;
AdaptaCustT.Open;

That's it. The monitor generates:


/*---
CONNECT DATABASE
localhost:c:\apps\adapta\adapta2000ibdata\ADAPTA2000CO1.GDB
DB_HANDLE = 14556136

SECONDS = 2.566
----*/
/*---
ALLOCATE STATEMENT 2
DB_HANDLE = 14556136
STMT_HANDLE = 14555824

SECONDS = 0.029
----*/
/*---
DATABASE INFO
DB_HANDLE = 14556136
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 14555780
----*/
/*---
ALLOCATE STATEMENT 2
DB_HANDLE = 14556136
STMT_HANDLE = 14555588
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 14555516
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 14555516
STMT_HANDLE = 14555588

SELECT RDB$FIELD_NAME
FROM RDB$INDEX_SEGMENTS
WHERE RDB$INDEX_NAME = ? /* Name */
ORDER BY RDB$FIELD_POSITION ASC

PLAN SORT ((RDB$INDEX_SEGMENTS INDEX (RDB$INDEX_6)))

FIELDS = [ Version 1 SQLd 1 SQLn 30
RDB$INDEX_SEGMENTS.RDB$FIELD_NAME = <NIL> ]

SECONDS = 0.170
----*/
/*---
DESCRIBE INPUT
STMT_HANDLE = 14555588
PARAMS = [ Version 1 SQLd 1 SQLn 1
< SQLType: 453 SQLLen: 31 > = <NIL> ]
----*/
/*---
ALLOCATE STATEMENT 2
DB_HANDLE = 14556136
STMT_HANDLE = 14550088
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 14555516
STMT_HANDLE = 14550088

SELECT I.RDB$RELATION_NAME
, I.RDB$INDEX_NAME
, I.RDB$UNIQUE_FLAG
, I.RDB$INDEX_TYPE
, I.RDB$FOREIGN_KEY
, ( SELECT C.RDB$CONSTRAINT_NAME
FROM RDB$RELATION_CONSTRAINTS C
WHERE C.RDB$INDEX_NAME = I.RDB$INDEX_NAME ) AS CNST
, ( SELECT R.RDB$UPDATE_RULE
FROM RDB$REF_CONSTRAINTS R
WHERE R.RDB$CONSTRAINT_NAME =
( SELECT C.RDB$CONSTRAINT_NAME
FROM RDB$RELATION_CONSTRAINTS C
WHERE C.RDB$INDEX_NAME = I.RDB$INDEX_NAME )) AS UR
, ( SELECT R.RDB$DELETE_RULE
FROM RDB$REF_CONSTRAINTS R
WHERE R.RDB$CONSTRAINT_NAME =
( SELECT C.RDB$CONSTRAINT_NAME
FROM RDB$RELATION_CONSTRAINTS C
WHERE C.RDB$INDEX_NAME = I.RDB$INDEX_NAME )) AS DR
FROM RDB$INDICES I
WHERE NOT I.RDB$RELATION_NAME STARTING WITH 'RDB$'

PLAN (C NATURAL)
PLAN (R INDEX (RDB$INDEX_13))
PLAN (C NATURAL)
PLAN (R INDEX (RDB$INDEX_13))
PLAN (C NATURAL)
PLAN (I NATURAL)

FIELDS = [ Version 1 SQLd 8 SQLn 30
RDB$INDICES.RDB$RELATION_NAME = <NIL>
RDB$INDICES.RDB$INDEX_NAME = <NIL>
RDB$INDICES.RDB$UNIQUE_FLAG = <NIL>
RDB$INDICES.RDB$INDEX_TYPE = <NIL>
RDB$INDICES.RDB$FOREIGN_KEY = <NIL>
[CNST] = <NIL>
[UR] = <NIL>
[DR] = <NIL> ]

SECONDS = 0.055
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 14555516
STMT_HANDLE = 14550088
PARAMS = [ ]

SECONDS = 0.020
----*/
/*---
OPEN CURSOR
STMT_HANDLE = 14550088
NAME = C1376021264056412

----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 14555516
STMT_HANDLE = 14555588
PARAMS = [ Version 1 SQLd 1 SQLn 1
[NAME] = 'RDB$PRIMARY22 ' ]

SECONDS = 33.249
----*/
/*---

And so on. There's a lot more, but it's too much for here. The total
time to connect and open the one (and only) table for the database
was about 55 seconds. The program and database are here on my home
computer. It does seem like a lot of time. Thanks