Subject | Re: How a stored procedure exectute? |
---|---|
Author | hfsnell |
Post date | 2008-10-13T11:12:50Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
to an output buffer. The procedure then waits (is suspended) until
the caller FETCHES that record from the buffer.
interface, this probably means "all the output that will fill the grid".
is expensive, since the entire procedure must complete in order to get
the matching rows. Write SELECT stored procedures with input
parameters to pass your search criteria - don't use a WHERE clause on
its output.
You make me clear now.
Very clear answer!
Thank again!
NHP
>make causes the most recent created set of output variables to be sent
> At 20:44 13/10/2008, you wrote:
> >Dear experts!
> >I supposed that a stored procedure execute and return a temporary
> >table. However, I am wrong!
>
> Yes, you are wrong. ;-)
>
> The way a "select" procedure works is that each SUSPEND call you
to an output buffer. The procedure then waits (is suspended) until
the caller FETCHES that record from the buffer.
>enough rows to fill its own (client-side) buffer. In the IBExpert
> >When I execute the following SQL:
> >select * from mysp();
> >it costs about 1 second.
>
> That is the length of time it takes for your application to fetch
interface, this probably means "all the output that will fill the grid".
>has 110 in t.
> >select * from mysp() where t=100
> >it costs about 1 second
>
> ..for the first output row that has 100 in t.
>
> >but
> >select * from mysp() where t=110
>
> ...all output is rejected, row by row, until the first output row
>same thing. These are not records on pages, they are rows of variables.
> >it costs 4 second.
> >I try many times and get same results.
>
> That is not surprising - since you are repeatedly doing exactly the
>cases.
> >I use IBExpert to make analysis, I found that the number of indices
> >read when the stored procedure executes are differnts at last two
>stored procedure. A WHERE clause in a SELECT from a stored procedure
> Any indexes used are those that apply to the queries *within* the
is expensive, since the entire procedure must complete in order to get
the matching rows. Write SELECT stored procedures with input
parameters to pass your search criteria - don't use a WHERE clause on
its output.
>OK! Thank Helen!
> ./heLen
>
You make me clear now.
Very clear answer!
Thank again!
NHP