Subject Re: AGAIN (i know, but different) Max optimized... or not?
Author skander_sp
In a database with 2 dozens of tables with this kind of numerators, and everyone with new triggers, new queries, and new fields... not easy, in the way of speed up the running...

The problem is the same, because the index is the same, a double field (year+orden)

thks , i see not much to do, if speed keep going down, i'm afraid i'll make changes you proposes. Tks again.

--- In firebird-support@yahoogroups.com, Christian Mereles <chmereles@...> wrote:
>
> Ok, I understand. While the second table "is not as complex" but if you want
> to take the index optimally try something like:
>
> select first 1 n_orden from ordenes
> where year_orden = new.year_orden
> order by* year_orden desc, n_orden desc*
> into new.n_orden;
>
> Regards.
>
> Christian
>
>
> [Non-text portions of this message have been removed]
>