Subject | Re: select in (subquery) |
---|---|
Author | tymorrisy |
Post date | 2004-12-15T15:21:20Z |
> >What would be the advantage of using a plan as opposed to subselects?subqueries.
>
> No answer to the question, since it's not a valid question. Plans are
> prepared for all SELECT statements, including those embedded as
>of the
> >I personally use subselects, but some people here use plans and they
> >are having a problem now with win 2003 server and firebird.
>
> Ummmm, this is a non-sequitur. All Selects use plans. It's the job
> optimizer to construct the best plan, given the indexes it hasprepared.
> available. You can see the optimizer's plan after the statement is
>clause in
> It's also possible to give the optimizer your own plan, as a PLAN
> the query statement itself (immediately preceding the ORDER BYclause, if
> there is one, otherwise as the last clause in the statement). Theeasiest
> way to do this is to take the optimizer's plan as a starting point anduses its
> modify it the way you think it ought to be. The optimizer still
> own plan for some internal calculations, but it won't try to override aplan
> user-supplied plan.
>
> In general, the optimizer knows what it's doing and returns the best
> for the statement you give it. If you get a plan that you think iswrong,
> it can mean one of two things: either the statement itself is notoptimal,
> or you have duplicate indexes in there. The optimizer is known toavoid an
> index altogether when it encounters dup indexes - hence, since Firebirdregard any
> creates its own mandatory indexes for keys (PK and FK) without
> existing indexes, it's not unusual to have optimizer problems ondatabase
> schemas that were imported from another RDBMS.The reason I am asking is I am having a problem with a Win 2k3 server
>
> ./heLen
and firebird 1.5.1.
I can see all my tables and indexs. I can copy the db to a win 2k
server and it runs fine. But on win 2k3 running this command will
cause firebird to restart its service:
select count(*) from capture where trandate > '12/01/2004' and
trandate < '12/12/2004' plan (capture index(cdateindx))
If I run this command it works fine:
select count(*) from capture where trandate > '12/01/2004' and
trandate < '12/12/2004'
By the way,
Thanks for the help. I am starting your book