Subject Re: ISQL Faster than IBO?.. why?
Author Carlos GarcĂ­a Trujillo
> The difference is ISQL is likely not preparing any statement at
all. It's
> probably just doing an execute immediate command and displaying the
result.

Something like that is what i supose...

> If you are using a statement over and over again then it makes
sense to have
> the cost of a prepare to be able to repeat execution, but if you
are using a
> different statement each time then you don't need to prepare it at
all.

That is my case... absolutely... different statements at the request
of the user with some experts programmed in the app to "translate"
the querys of the user to SQL.

> You can use the ExecuteImmediate function within IBO to avoid
preparing a
> statement.

That would be great!!, but as i can see this function works with
INSERT, UPDATE, DELETE statements, can i use something like that to
work with cursors or datasets???

> Perhaps you could tell me a bit more of what you are doing so I can
help you
> more.

Sure!, i'm working in a kind of OLAP application, with a lot of
querys readonly to allow select records of different relations and
combinations of views with SP's, so is common to need to request
different statements to the server at the time, so with every new
statement a new (slow) prepare operation is triggered. The prepare
statement is wath takes all the time, the data transfer is almost
instantaneous in IBO, but the continuous re-prepare for arbitrarious
statements is the problem.

> Also, please put a TIB_UtilityBar in your app, set the IB_Connection
> property and then pop open a SQL trace dialog to watch exactly what
is
> happening on the server and it will tell you what is taking so
long. This
> will give me more hints to help you with.

i did it :-), here is a sample of one of my querys over the slow
connection:

/*---
PREPARE STATEMENT
TR_HANDLE = 3950112
STMT_HANDLE = 3951160

SELECT GES_ID
, GES_NOMBRE
, GES_TELEFONO
, JUR_NOMBRE
FROM AFI_GESTORES
LEFT JOIN GEN_CIUDADES ON (GES_CIUDAD = CIU_ID)
LEFT JOIN AFI_JURISDICCION ON (CIU_JURISDICCION = JUR_ID)
WHERE (
(GES_NOMBRE CONTAINING ? /* TEXTOBUSCADO */ ) or
(JUR_NOMBRE CONTAINING ? /* TEXTOBUSCADO */ ))

PLAN JOIN (JOIN (AFI_GESTORES NATURAL,GEN_CIUDADES INDEX
(PK_GEN_CIUDADES)),AFI_JURISDICCION INDEX (PK_AFI_JURISDICCION))

FIELDS = [ Version 1 SQLd 4 SQLn 30
AFI_GESTORES.GES_ID = <NIL>
AFI_GESTORES.GES_NOMBRE = <NIL>
AFI_GESTORES.GES_TELEFONO = <NIL>
AFI_JURISDICCION.JUR_NOMBRE[JUR_NOMBRE] = <NIL> ]

SECONDS = 3.054
----*/
/*===
//>>> STATEMENT PREPARED <<<//
TIB_Statement.API_Prepare()
TIBOInternalDataset: "BGestores.IBOqrBGestores" stHandle=3951160
====*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 3950112
STMT_HANDLE = 3951160
PARAMS = [ Version 1 SQLd 2 SQLn 2
[TEXTOBUSCADO] = ''
[TEXTOBUSCADO] = '' ]

SECONDS = 0.120
----*/
/*---
FETCH
STMT_HANDLE = 3951160
FIELDS = [ Version 1 SQLd 4 SQLn 4
AFI_GESTORES.GES_ID = 2
AFI_GESTORES.GES_NOMBRE = 'DRA. ANA LUISA TEJEDA'
AFI_GESTORES.GES_TELEFONO = '044 686 569 9364'
AFI_JURISDICCION.JUR_NOMBRE[JUR_NOMBRE] = 'MEXICALI' ]

SECONDS = 0.060
----*/


as you can see the prepare time is of 3.054 seconds, but the data-
transfer time is just of a few miliseconds, if i could just avoid to
prepare my querys with something like "OpenImmediate" would be
great!!, i know that all the statements that are query'ed to the
database are valid ones because i check and create the statements
myself with my "experts".

> You don't need to use any other toolset because with IBO you can go
as low
> as you want to work as efficiently as you want. For that matter,
if you
> wanted to put together your own native BLR requests with IBO you
can do that
> too.

Thanx Jason, i don't know so much about all the great features of
IBO, i even didn't know about this ExecuteImmediate function. You
have think in all the situations in C/S as i can see, so i'm sure
that must have something i'm missing in my configuration or that can
be improved. As i say to my partners: "IBO is a Pro-Suite, so must be
a lot more faster, and powerfull that those that you are trying to
make usable" =:-)

P.D. Are there some links where we could study about the BLR
instructions that you say???