hi,
1. select first 100 ... from my_state_table2. delete from my_state_table ;-)
after this your query will be very fast ;-)
Ask self. Did i describe my problem for others that they can help me. The
answer is NO
show us reall query, query plan, statistics...
regards,Karol Bieniaszewski
-------- Oryginalna wiadomość --------
Od: "Germán Balbi [email protected] [firebird-support]"
<[email protected]>
Data: 03.02.2016 17:24 (GMT+01:00)
Do: [email protected]
Temat: Re: [firebird-support] How to optimize queries on field state
The idea is the following.
Have products and services that pass through different states (order,
committed, reviewed, approved, slope, bill, invoice), these may belong to a
period or many (period = months).
The filter may include the client query or not.
La idea es la siguiente.
Tengo productos y servicio que pasan por distintos estados (pedido,
comprometido,revisado, aprovado, pendiente, a facturar, facturado), estos
pueden pertenecer a un periodo o a muchos (periodo=meses).
El filtro del query puede incluir el cliente o no.
El Miércoles, 3 de febrero, 2016 12:23:31, "Thomas Steinmaurer
[email protected] [firebird-support]" <[email protected]>
escribió:
> I have a state machine (workflow) implemented on a table a couple of
> million records and growing.
> I have crated an index on the "state" field. The possible states are
> very few (5 to 10). Obviously selectivity index is terrible. As I can
> optimize the query?
Hard to say without seeing an actual query ...
Is the state field the only one used to filter the result set?
--
With regards,
Thomas Steinmaurer
http://www.upscene.com/
Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.