Subject | Use of indexes in this scenario |
---|---|
Author | OB1 |
Post date | 2008-08-03T11:17:05Z |
For one of my applications, information is cached locally and Firebird
events are used to inform the clients that a table has changed. All
my tables have a 'ChangedID' column which contains a value from a
generator. Whenever a row is inserted, updated or marked as deleted,
the ChangedID column is assigned a new generator value by a trigger.
Using the above, whenever the client receives an event saying data has
changed, it can request all the new/altered rows using the ChangedID
in the where clause: SELECT xyz FROM Table WHERE ChangedID >
previousHighestChangeID
This is crying out for an index, but I wonder whether this is going to
affect database adversely due to constantly rebuilding the index. For
this application, there will be roughly 10x as many SELECTS as
Inserts/Updates/Deletes. This is not an automated system,
inserts/updates/deletes are user initiated and are likely to occur
every 2-10s.
Are my concerns about constantly rebuilding hte index unfounded?
Many thanks
events are used to inform the clients that a table has changed. All
my tables have a 'ChangedID' column which contains a value from a
generator. Whenever a row is inserted, updated or marked as deleted,
the ChangedID column is assigned a new generator value by a trigger.
Using the above, whenever the client receives an event saying data has
changed, it can request all the new/altered rows using the ChangedID
in the where clause: SELECT xyz FROM Table WHERE ChangedID >
previousHighestChangeID
This is crying out for an index, but I wonder whether this is going to
affect database adversely due to constantly rebuilding the index. For
this application, there will be roughly 10x as many SELECTS as
Inserts/Updates/Deletes. This is not an automated system,
inserts/updates/deletes are user initiated and are likely to occur
every 2-10s.
Are my concerns about constantly rebuilding hte index unfounded?
Many thanks