Subject Re[2]: [firebird-support] How I can speed up this query
Author Daniel Miller
On 10/12/2017 12:24:11 AM, "Luigi Siciliano luigisic@...
[firebird-support]" <firebird-support@yahoogroups.com> wrote:

>Hallo,
>
>Il 11/10/2017 20.38, setysvar setysvar@... [firebird-support] ha
>scritto:
>>I think this should give the same result as your query, whether or not
>>it is any quicker, I simply do not know (but I would love to hear if
>>it
>>made any difference).
>
>Your query is to slow, flamerobin tells 4.360s. :(
>>PLAN (PNC2 NATURAL)
>>
>>seems to be your problem (PNC on the other hand, seems OK).
>>
>>Hence, if PARITA and/or SCADENZA are selective, I would recommend that
>>you create an index for either or both of these fields. That way, I
>>would assume your original query to become a lot quicker.
>Ok, I create an index for PARTITA and SCADENZA fields for PNC and Your
>query speed up, Flamerobin now tells 0.060s :)
>
>And, my query, now, flamerobin tells 0.045s :))
>
>The secondary index are automatically maintained by server, is it right
>to do a periodically manually maintenance for it's?
>
It would be interesting to compare the plans for both your original
query syntax and Set's suggestion - see where the difference is.

As for index maintenance, see http://www.firebirdfaq.org/faq167/

With a significant amount of deletes database maintenance becomes more
important. Static tables, or tables that generally just grow, don't
experience much fragmentation.
--
Daniel