Subject | Re: How to retrieve execution plan? |
---|---|
Author | harri007et |
Post date | 2004-02-16T19:04:57Z |
Hi Svein,
100% sure any more
FROM YLD_TABEL_VIEW YTW
JOIN OSALEJA OS ON OS.ONNETUS_ID = YTW.LO_ID
JOIN KANNATANU KAN ON KAN.OSALEJA_ID = OS.ID
JOIN YLD_TABEL YLD ON YLD.LO_ID = KAN.ONNETUS_ID
WHERE ...
All JOIN-s use primary keys and unique indexes on columns, that are
not available to users - so I thought it must be safe. But it
appears, that even an the unique index can have a bad statistics.
Users also dont have access to columns that are used in join clause
of the view definition.
I forgot from my first message, that it was a SELECT DISTINCT query.
But it shouldn't matter.
regards,
Harri
> >>> AND (NOT KAN.SUGU IS NULL)started
> >>> This quey took 6 minutes(plan had 2xnatural). Without "where"
> >>> clause it ran ~1 sec(1xnatural). I removed all clauses and
> >>> to put them back one by one. Would you beleive, that it was thesaid
> >>> "NOT" inside the last clause. Without NOT it used index(1 sec),
> >>> with NOT it didn't(6 min). As changing of the order had no
> >>> impact(as always) to quey plan, I was out of ideas.
> >>>
> >> Hmm, interesting. Why would a NOT have this effect? I'd try a
> >> couple of changes to see if they made any impact:
> >
> > NOT NULL doesn't use a index, that's correct.
>
> Yes, that bit sounds correct, but from what I read I thought he
> that AND (NOT KAN.SUGU IS NULL) actually removed an index from theit was only the word "NOT" .. well, now, when you ask, I'm not a
> plan
100% sure any more
>(that presumably was used due to SUGU being part of the WHERE or...
> JOIN clause of a view definition).
FROM YLD_TABEL_VIEW YTW
JOIN OSALEJA OS ON OS.ONNETUS_ID = YTW.LO_ID
JOIN KANNATANU KAN ON KAN.OSALEJA_ID = OS.ID
JOIN YLD_TABEL YLD ON YLD.LO_ID = KAN.ONNETUS_ID
WHERE ...
All JOIN-s use primary keys and unique indexes on columns, that are
not available to users - so I thought it must be safe. But it
appears, that even an the unique index can have a bad statistics.
Users also dont have access to columns that are used in join clause
of the view definition.
I forgot from my first message, that it was a SELECT DISTINCT query.
But it shouldn't matter.
regards,
Harri