Subject Re: update take manu time
Author Adam
--- In firebird-support@yahoogroups.com, Luiz Rafael Culik Guimaraes
<culikr@...> wrote:
>
> Dear Friend
>
> I have an simple update with only one field and this update command is
> taking too much time (0.2800) on an windows 98 server with classic
server
> running on an 256Mb Flash Drive
> the query is
> UPDATE "TBL_TERMINAIS" SET "APOSTA" = 10 WHERE "ID_TERMINAL" = 8
> i have na index on ID_TERMINAL Field
>
> any idea to speed up this query?

You have identified the problem already.

You are asking Firebird to find every record where 'ID_TERMINAL = 8',
but have not defined an index that it can use to eliminate all of the
other ID_TERMINAL records. So Firebird must read every record, and one
by one decide whether it should be updated. The larger your table
grows, the more records it must check. That is why it is so slow.

Add an index:

CREATE INDEX IX_TBL_TERMINAIS_ID_TERMINAL FOR TBL_TERMINAIS (ID_TERMINAL);

Then check the performance.

If ID_TERMINAL is a primary key, do not add the index as it already
has one, your problem will be elsewhere. The problem is possibly
because of a trigger on that table, or more likely because Windows 98
never had usb2 support (or if it did it never worked properly). If
that is the case, I'm afraid it won't run any faster over USB.

Adam