Subject | Re: SQL Performance problem |
---|---|
Author | GrumpyRain |
Post date | 2004-11-26T00:08:50Z |
You are right Alexandre,
I duplicated your test and it worked. The view I had troubles with was
a lot more complex that a simple primary key filter though, so maybe
on complex views with several joins, several possible index
selections, and about 10 things in the where clause the optimiser
might give up and just use brute force.
All I did was to pull the query out of the view and into the
application and it ran about 15 seconds faster straight away. It may
even have been possible to re-write the view into a manner that help
the optimiser.
On a similar note, do you know if it is possible (or if it is planned)
to implement something similar to a Hint directive in oracle. The
optimiser is great most of the time, but sometimes it gets it wrong
and you have to use a left join etc to make sure a given index is used.
Adam
I duplicated your test and it worked. The view I had troubles with was
a lot more complex that a simple primary key filter though, so maybe
on complex views with several joins, several possible index
selections, and about 10 things in the where clause the optimiser
might give up and just use brute force.
All I did was to pull the query out of the view and into the
application and it ran about 15 seconds faster straight away. It may
even have been possible to re-write the view into a manner that help
the optimiser.
On a similar note, do you know if it is possible (or if it is planned)
to implement something similar to a Hint directive in oracle. The
optimiser is great most of the time, but sometimes it gets it wrong
and you have to use a left join etc to make sure a given index is used.
Adam