Subject | Re: [IBO] skip metadata to increase remote speed? |
---|---|
Author | hkuser2001 |
Post date | 2002-11-28T13:17:37Z |
--- In IBObjects@y..., Helen Borrie <helebor@t...> wrote:
after I enabled it, the initial open speed increased as it doesn't
load the metadata on subsequent connections. However, there are
errors when running in the IDE, it looks like the IBO$SCHEMA_VERSION
table is missing. I cannot find the details of this table, so I
cannot create it manually (I tried to call
SchemaCache.CheckSchemaVersionTable, but it failed). Attached is my
monitor output:
Call Ib_Connection1.Connect
/*---
CONNECT DATABASE ora8i.minidns.net:/u/fbdata/sms.fdb
DB_HANDLE = 4150260
SECONDS = 0.500
----*/
Call IB_Query1.Open:
/*---
DATABASE INFO
DB_HANDLE = 4150260
SECONDS = 0.188
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 4150092
SECONDS = 0.062
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 4149636
SECONDS = 0.062
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4149636
STMT_HANDLE = 4149708
SELECT SCHEMA_ITEM || '=' || VERSION_NUMBER
FROM IBO$SCHEMA_VERSION
ORDER BY 1 ASC
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
SECONDS = 0.094
ERRCODE = 335544569
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4149636
STMT_HANDLE = 4149708
SELECT SCHEMA_ITEM || '=' || VERSION_NUMBER
FROM IBO$SCHEMA_VERSION
ORDER BY 1 ASC
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
SECONDS = 0.125
ERRCODE = 335544569
----*/
/*---
INTERPRETE BUFFER =
ERRCODE = 17
----*/
/*---
INTERPRETE BUFFER = Dynamic SQL Error
ERRCODE = 21
----*/
/*---
INTERPRETE BUFFER = SQL error code = -204
ERRCODE = 13
----*/
/*---
INTERPRETE BUFFER = Table unknown
ERRCODE = 18
----*/
/*---
INTERPRETE BUFFER = IBO$SCHEMA_VERSION
ERRCODE = 20
----*/
/*---
INTERPRETE BUFFER = At line 2, column 6.
ERRCODE = -1
----*/
/*---
COMMIT
TR_HANDLE = 4149636
SECONDS = 0.219
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4150092
STMT_HANDLE = 4149900
SELECT ID, NAME FROM BRAND
PLAN (BRAND NATURAL)
FIELDS = [ Version 1 SQLd 2 SQLn 30
BRAND.ID = <NIL>
BRAND.NAME = <NIL> ]
SECONDS = 5.875
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 4150092
STMT_HANDLE = 4149900
PARAMS = [ ]
SECONDS = 0.422
----*/
Many thanks to your superb support.
> At 06:56 AM 28-11-02 +0000, you wrote:open,
> >Dear all,
> >
> >I am using IBO4.2Ib on WinXP. The server is Firebird 1.0 stable
> >release version (tried both Linux/ WinXP versions).
> >
> >Connection to server with effective throughput of 512Kbps.
> >
> >When I initially open a IB_Query which only needs to returns a few
> >rows, it takes up to 7 secs. Subsequent open is much faster, within
> >1 to 2 seconds. I used the monitor to find that, in the initial
> >most time is spent on getting metadata and table structure , like:first,
> >"SELECT S.RDB$FIELD_NAME ..."
>
> OK, we are looking at two things here. Looking at the second one
> the "SELECT S.RDB$FIELD_NAME ..." will happen once per CONNECTIONif you
> have local schema caching enabled. You can turn this off in yourclient by
> setting the SchemaCacheDir to nil. In the course of your session,you will
> lose the benefit of having IBO read your metadata locally; but itlooks as
> if your user might be connecting and disconnecting frequently - inwhich
> case the schema cache is more of a burden than a benefit.specification
>
> Now, the other one is the Prepare sequence. If the statement
> doesn't change, this should occur only on the very first call toOpen. If
> you are replacing the SQL of the query every time you open it, thenPrepare
> is happening EVERY time. Two seconds is a VERY long time for aprepared
> query to return only a few rows.is
>
>
> >Can I make the Query to skip this? Becuase sometimes I only want to
> >run a very simple query, I don't need these metadata.
>
> The statement ALWAYS needs the metadata - that is what the Prepare
> for. If possible, you should architect your queries so that theyget
> prepared once and remain prepared. That means using parameterswherever
> possible.to speed
>
> And, of course, you should design your metadata so that they help
> up your queries, not slow them down. For example, duplicateindexes on
> primary and foreign keys are performance-killers; as are indexesor
> foreign keys on lookup columns which have a small distribution ofpossible
> values throughout the table; as are ordering or joining columnswhich have
> better distribution but which have no indexes at all, or badindexes.
>handlers that
> So you need to tell us more about 1) the queries and 2) the
> you are using to open them.The schemacachedir was already disabled (blank). In the contrary,
>
> Helen
after I enabled it, the initial open speed increased as it doesn't
load the metadata on subsequent connections. However, there are
errors when running in the IDE, it looks like the IBO$SCHEMA_VERSION
table is missing. I cannot find the details of this table, so I
cannot create it manually (I tried to call
SchemaCache.CheckSchemaVersionTable, but it failed). Attached is my
monitor output:
Call Ib_Connection1.Connect
/*---
CONNECT DATABASE ora8i.minidns.net:/u/fbdata/sms.fdb
DB_HANDLE = 4150260
SECONDS = 0.500
----*/
Call IB_Query1.Open:
/*---
DATABASE INFO
DB_HANDLE = 4150260
SECONDS = 0.188
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 4150092
SECONDS = 0.062
----*/
/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 4149636
SECONDS = 0.062
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4149636
STMT_HANDLE = 4149708
SELECT SCHEMA_ITEM || '=' || VERSION_NUMBER
FROM IBO$SCHEMA_VERSION
ORDER BY 1 ASC
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
SECONDS = 0.094
ERRCODE = 335544569
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4149636
STMT_HANDLE = 4149708
SELECT SCHEMA_ITEM || '=' || VERSION_NUMBER
FROM IBO$SCHEMA_VERSION
ORDER BY 1 ASC
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
SECONDS = 0.125
ERRCODE = 335544569
----*/
/*---
INTERPRETE BUFFER =
ERRCODE = 17
----*/
/*---
INTERPRETE BUFFER = Dynamic SQL Error
ERRCODE = 21
----*/
/*---
INTERPRETE BUFFER = SQL error code = -204
ERRCODE = 13
----*/
/*---
INTERPRETE BUFFER = Table unknown
ERRCODE = 18
----*/
/*---
INTERPRETE BUFFER = IBO$SCHEMA_VERSION
ERRCODE = 20
----*/
/*---
INTERPRETE BUFFER = At line 2, column 6.
ERRCODE = -1
----*/
/*---
COMMIT
TR_HANDLE = 4149636
SECONDS = 0.219
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 4150092
STMT_HANDLE = 4149900
SELECT ID, NAME FROM BRAND
PLAN (BRAND NATURAL)
FIELDS = [ Version 1 SQLd 2 SQLn 30
BRAND.ID = <NIL>
BRAND.NAME = <NIL> ]
SECONDS = 5.875
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 4150092
STMT_HANDLE = 4149900
PARAMS = [ ]
SECONDS = 0.422
----*/
Many thanks to your superb support.