Subject | Re: [IBO] Database theory, help needed. |
---|---|
Author | lester@lsces.globalnet.co.uk |
Post date | 2001-08-12T09:15:25Z |
> HiFields should not matter, records will as you have to count.
> I have an SQl
> Select Count(column1)
> >From Mytable
> where column2 > :A
> and column3 < :B
> and column4 = :D
> and column1 = :E
> there are say 20,000 records in Mytable.
> and the result is likely to be about 25.
> Given the result, how much is the speed of this sql going to depend on
> 1. The number of fields in Mytable ?
> 2. The number of records in MyTable ?
The trick ( which I am still learning ) is to have the correct indexes set
up. You will need them on column2 and column3, so that the PLAN can reduce
the number of records fast. Not sure whether column 4 and 1 would benefit.
Any more informed input anyone?
> Given that the parameters A and B are known some 5 minutes in advanceCopying to a second table is certainly a waste of time, but some more
> of parameters D and E.
> And Parameters D and E are changed by the user quite often (say 6
> times in 2 minutes as his mind changes) and the query re-run, I
> originally programmed to select on parameters A and B into another
> table. Then selected from that much smaller table using D and E to
> get the result...but I am beginning to doubt whether that was really
> desirable given the overhead of the transfer to a smaller table.
informed person would probably be creating a stored procedure to produce the
column2/column3 subset, which I believe would be cached, so that the other
enquiries would be made against that.
Again - can anybody educate us further?
> Full marks will be obtained for the corect answer to one or moreI always passed exams by waffle rather than answering the original question,
> questions!
but hopefully this is pushing in the right direction as I would like to learn
more.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services