Subject | Re: [IBO] Problem using locate |
---|---|
Author | John Costanzo |
Post date | 2006-08-17T12:42:52Z |
Hello Jay:
Thanks for the tip about datasource.ondatachange. I will try it.
As far as my particular application goes, the client wants it to
work exactly as the Paradox version works, thuis forcing me to do
lookups into the 3 million+ file. I will keep messing weith this in
my spare time but for now it looks like I will have to stick with
the BDE/Paradox version since it runs circles around the IBO version.
Thanks
--- In IBObjects@yahoogroups.com, "Jose Ostos Turner" <jostost@...>
wrote:
will fetch ALL records and keep them in memory it DOES NOT position
itsel according to the index. With a WHERE condition it will only
read ALL the records that comply with the condition. If the
condition can use an existing index, it will use it and can be very
fast (reading only the records according to the index), if the
condition can not use an index, it has to read ALL records. That is
the way that SQL databases work.
you have obtained the records (resultset) in memory, the work is
being done by the client and not the server, and the client has NO
KNOWLEDGE of any index and will continually read ALL records in
memory secuentially which is very inafficient.
needs.
this event many times unnecesarrily. If you have your LOCATE int
this event, it will probably be executing several times instead of
once as you would expect. Under your circumstances this will GREATLY
MAGNIFY you problem. I Suggest trying the Datasource.OnDataChange
event instead checking that "Field=nil" to make sure it only
executes when changing records. AfteScroll make be executing every
time a field changes in the record, e.g. if the record has 15
fields, it may be executing 15 times on every record cjhange.
Thanks for the tip about datasource.ondatachange. I will try it.
As far as my particular application goes, the client wants it to
work exactly as the Paradox version works, thuis forcing me to do
lookups into the 3 million+ file. I will keep messing weith this in
my spare time but for now it looks like I will have to stick with
the BDE/Paradox version since it runs circles around the IBO version.
Thanks
--- In IBObjects@yahoogroups.com, "Jose Ostos Turner" <jostost@...>
wrote:
>it just positions itself according to the index. With SQL (any DB)
> With Paradox, when you open a file, it does not read all records,
will fetch ALL records and keep them in memory it DOES NOT position
itsel according to the index. With a WHERE condition it will only
read ALL the records that comply with the condition. If the
condition can use an existing index, it will use it and can be very
fast (reading only the records according to the index), if the
condition can not use an index, it has to read ALL records. That is
the way that SQL databases work.
>the same time (FecthAll=True) or as required (FecthAll=False). Once
> As I said before, ALL records will be read into memory either at
you have obtained the records (resultset) in memory, the work is
being done by the client and not the server, and the client has NO
KNOWLEDGE of any index and will continually read ALL records in
memory secuentially which is very inafficient.
>to avoid this, and you have to figure out which is the best for your
> You have to find a way to do a diferent select the detail records
needs.
>AfterScroll event. My experience has been that it seems to executes
> At some point in your first posts, you mentioned the use of the
this event many times unnecesarrily. If you have your LOCATE int
this event, it will probably be executing several times instead of
once as you would expect. Under your circumstances this will GREATLY
MAGNIFY you problem. I Suggest trying the Datasource.OnDataChange
event instead checking that "Field=nil" to make sure it only
executes when changing records. AfteScroll make be executing every
time a field changes in the record, e.g. if the record has 15
fields, it may be executing 15 times on every record cjhange.
>name
> Hope this helps.
> Jay
>
>
> ----- Mensaje original -----
> De: John Costanzo
> Para: IBObjects@yahoogroups.com
> Enviado: Miércoles, 16 de Agosto de 2006 08:04 a.m.
> Asunto: Re: [IBO] Problem using locate
>
>
> Hello:
>
> The table has 3.2 Million records. There are 2 indexes. The
> primary key is as follows: CONSTRAINT PK_ID AS PRIMARY KEY ("ID")
>
> The index is as follows: CREATE UNIQUE INDEX OWNERNAMEIDX ON
> OHIOFUNDS ("OWNERNAME", "ID")
>
> Ownername is not unique so ID, which is unique, is added.
>
> When I initially connected to the database connection took 4
> minutes. After posting a message about this Hellen suggested I
> the database something other than .gdb because of a Windows XPminutes.
> problem. I renamed the database to .ib and connection time went
> down to 30 seconds. I have tried a few other extentions but
> connection time seems to stay at around 30 seconds. This only
> happens on the 1st connection after a reboot. Subsequent
> connections are instant untill the next reboot.
>
> In any case, the 1st time I do the query it took several
> Subsequent queries, whether for the same ownername or not, aremuch
> faster but still around 2 to 3 seconds.the
>
> I found that my setting up a master/detail relationship between
> small and large file it works reasonably well. However, here iswhat
> happens. As long as I move record by record or search for aon,
> ownername that is no to far in the file from the ownername I am
> all goes well. But let's say I am on ownername ALBERT and Isearch
> for ownername SMITH. A message box appears stating FETCHING ROW#be
> XXXXX, the ROW continues to update and the system goes off into
> never never land for some period of time, eventually, SMITH will
> displayed and all works fine. THIS ONLY HAPPENS ONCE. Afterthat,
> searches anywhere on the file work fine and search time isaround a
> second or less. My only guess is that the applicatio is fetchingall
> records from the server causing the delay. To prove this I setthe
> queries AutoFetchAll property, which is normally False, to True.come
> Now when I restart the application it takes about 2 minutes to
> up but, once up, I can search for any record without the 1strecord
> search delay.BDE
>
> All this being said, none of it actually fixes my problem. The
> application has 2 grids. When the user moves through the smallgrid
> (which displays only owners who owe a large enough amount ofmoney
> to make it work persuing) the same owner is displayed in thelarge
> grid (which shows all monies owed by anyone having the sameowner
> name) Since the people that entered the information make typosetc
> the lawyers want to see all owner by the same or close nameslike
> SMITH or SMITHS or SMIHTS. In the BDE version I simply do alocate
> into the large file for "ID" every time the small file scrolls.for
> This keeps the large and small files in sync. The user seatches
> SMITH in the small file and anyone close to SMITH is dieplayedon
> the large grid. Works great. This is what I wanted toaccomplish.
> I really don't want to SELECT a subset of records in the largegrid,
> I simply want to establish position in the large files basedon 'ID'
> (which will be the same ID) in the large file. Selecting asubset
> does not accomplish this. Master/Detail sort of works but limitsfetching
> the large grid to only SMITH.
>
> Problem is if I use LOCATE on "ID" the message box about
> records is diplayed and the fetch takes HOURS!!!. Eventually Iget
> control again and the proper records are displayed in the largefiles
> grid.
>
> Keylinks seemed to be the answer. I thought if I linked the
> together with keylinks "ID" all, would work. Problem is, if theexactly
> user moves record by record with a navigator bar, all works
> as expected, if the user is at ALBERT and searches for BAKER,all
> works as expected, however, if the user is at ALBERT andsearches
> for SMITH, the fetching records message box is diplayed and thenavigator
> fetch takes HOURS!!! God forbid the use is sitting near the
> beginning of the file and clicks the Last Button on the
> bar, the fetching records message box is displayed and it truelythere
> will be the last thing the user does for several hours!!!
>
> --- In IBObjects@yahoogroups.com, Svein Erling Tysvær
> <svein.erling.tysvaer@> wrote:
> >
> > Sorry John, I don't believe you.
> >
> > SELECT * FROM XXXXXXXX
> > WHERE OWNERNAME = 'RANKLEY'
> > ORDER BY OWNERNAME
> >
> > cannot possibly take minutes to return a handful of records if
> > OWNERNAME is indexed. Well, maybe it is possible, but then
> arecopy
> > other problems that causes this (e.g. Windows XP doing a file
> ofthe
> > .gdb files before allowing anyone to access them or there being
> > thousands of fields to transfer and you connecting through the
> > Internet), not the select itself.
> >
> > Firebird is generally fast, and - if treated correctly - a lot
> better
> > than Paradox to handle large tables. I would expect the above
> query to
> > execute in less than a second, not two seconds.
> >
> > So, what is it that you're not telling us? Is the above SQL
> exacttold us
> > query you're executing or are there other parts you've not
> > about. What's the reported plan (you can find this by e.g.typing
> itsays
> > into IB_SQL and prepare the statement) and your table/index
> definitions?
> >
> > HTH,
> > Set
> >
> > --- In IBObjects@yahoogroups.com, "John Costanzo" wrote:
> > >
> > > Hello:
> > >
> > > I meant to say OWNERNAME. Ownername is the field that is
> indexed
> > > and the query selects ownername = xxxxx.
> > >
> > > > I then wrote a IBO test application. One databound grid, 1
> > > > IBOQuery, 1 button. The SQL for the query is
> > > > SELECT * FROM XXXXXXXX
> > > > WHERE OWNERNAME = RANKLEY
> > > > ORDER ON OWNERNAME (Ownwername is a defined index).
> > > > The Grid is linked to the query. The button code simply
> > > > query1.active := true. When I click the button the IBOcursor
> > > > is displayed and the program goes to never never land foruser
> almost
> > > > 2 minutes before the grid is displayed. Unless I am doing
> > > > something real wrong, this would mean that every time the
> > > > selected a name from the top grid there would be a lag ofat
> > > > least 2 minutes (I say at least because I selected Rankleyhappen
> > > > because he only had a dozen or so records). What would
> > > > if I selected SMITH?
> >
>
>
>
>
>
> [Non-text portions of this message have been removed]
>