Subject | Re: [IBO] skip metadata to increase remote speed? |
---|---|
Author | Helen Borrie |
Post date | 2002-11-28T07:35:24Z |
At 06:56 AM 28-11-02 +0000, you wrote:
the "SELECT S.RDB$FIELD_NAME ..." will happen once per CONNECTION if you
have local schema caching enabled. You can turn this off in your client 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 it looks as
if your user might be connecting and disconnecting frequently - in which
case the schema cache is more of a burden than a benefit.
Now, the other one is the Prepare sequence. If the statement specification
doesn't change, this should occur only on the very first call to Open. If
you are replacing the SQL of the query every time you open it, then Prepare
is happening EVERY time. Two seconds is a VERY long time for a prepared
query to return only a few rows.
for. If possible, you should architect your queries so that they get
prepared once and remain prepared. That means using parameters wherever
possible.
And, of course, you should design your metadata so that they help to speed
up your queries, not slow them down. For example, duplicate indexes on
primary and foreign keys are performance-killers; as are indexes or
foreign keys on lookup columns which have a small distribution of possible
values throughout the table; as are ordering or joining columns which have
better distribution but which have no indexes at all, or bad indexes.
So you need to tell us more about 1) the queries and 2) the handlers that
you are using to open them.
Helen
>Dear all,OK, we are looking at two things here. Looking at the second one first,
>
>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 open,
>most time is spent on getting metadata and table structure , like:
>"SELECT S.RDB$FIELD_NAME ..."
the "SELECT S.RDB$FIELD_NAME ..." will happen once per CONNECTION if you
have local schema caching enabled. You can turn this off in your client 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 it looks as
if your user might be connecting and disconnecting frequently - in which
case the schema cache is more of a burden than a benefit.
Now, the other one is the Prepare sequence. If the statement specification
doesn't change, this should occur only on the very first call to Open. If
you are replacing the SQL of the query every time you open it, then Prepare
is happening EVERY time. Two seconds is a VERY long time for a prepared
query to return only a few rows.
>Can I make the Query to skip this? Becuase sometimes I only want toThe statement ALWAYS needs the metadata - that is what the Prepare is
>run a very simple query, I don't need these metadata.
for. If possible, you should architect your queries so that they get
prepared once and remain prepared. That means using parameters wherever
possible.
And, of course, you should design your metadata so that they help to speed
up your queries, not slow them down. For example, duplicate indexes on
primary and foreign keys are performance-killers; as are indexes or
foreign keys on lookup columns which have a small distribution of possible
values throughout the table; as are ordering or joining columns which have
better distribution but which have no indexes at all, or bad indexes.
So you need to tell us more about 1) the queries and 2) the handlers that
you are using to open them.
Helen