Subject Re: Optimze Query
Author amoradell
Hello,

1 - Is article.enabled indexed ?
2 - Is article.enabled switchable ? 0 to 1 or 1 to 0 ?
3 - If no (always 0 to 1), you could add in where clause " and
a.enabled=0"
4 - What is 104017 ? ARTICLE_CONTENTTREE_LINK.TREEID ?
5 - If yes, you could write
select 1 from ARTICLE_CONTENTTREE_LINK al
JOIN SP_CT_VIDLIST_WITHROOT(S.treeid) s ON (1=1)
where s.treeid=104017

Regards

Alexandre

--- In firebird-support@yahoogroups.com, "nilsboedeker"
<nils.boedeker.support@...> wrote:
>
> Hi
>
> i try:
> > the In clause with Exists clause
> >
> > update article a set a.enabled=1
> > where exists (select 1 from ARTICLE_CONTENTTREE_LINK al
> > INNER JOIN SP_CT_VIDLIST_WITHROOT(104017) s ON
> > (al.TREEID = s.RTREEID) where al.articleid=a.relid)
> >
> > regards
> >
> > Alexandre
>
> No Index used...
>
> Plan:
> PLAN JOIN ((SP_CT_VIDLIST NATURAL)
> PLAN (CONTENTTREE INDEX (RDB$PRIMARY2)), AL INDEX (RDB$PRIMARY52))
> PLAN (A NATURAL)
>
> Adapted plan:
> PLAN JOIN ((SP_CT_VIDLIST NATURAL)
> PLAN (CONTENTTREE INDEX (PK_CONTENTTREE)), AL
> INDEXPK_ARTICLE_CONTENTTREE_LINK52))
> PLAN (A NATURAL)
> 11 record(s) was(were) updated in ARTICLE
>
> any more ideas or do you need more information?
>
> with best regards
>
> Nils
>