Ordered update cursors?
Posted in 1993
Topics: SQL Development & Query Writing
According to the Informix SQL reference and tutorial manuals, the select statement associated with an update cursor may not include an "order by" clause. I'm curious as to why and what workarounds are possible to achieve the same effect. My application will have a table whose rows represent queued "jobs" with associated priority and other scheduling information. The idea was to have concurrent processes controlling various resources run update cursors through this table looking for work to do and updating columns in a row to claim a job. If it was possible to have the cursors traverse the rows in "scheduling priority sequence", the prioritized dispatching of jobs would become trivial: each "resource process" would fetch and lock rows in the proper priority sequence, update some columns to mark a "job" as its own, and write the row back. Other update cursors would block during the update, and once the locks were released the particular row would no longer match the qualifying select ("find work to do") and they would move on to consider the next rows in priority sequence. I suspect that a "where" clause involving an indexed column on a priority field would cause the rows to be presented in index sequence, but is it safe to rely on that? A novice alert is in order here; I have tried to do my homework while waiting on our copy of OnLine to arrive. Many thanks for any info. -- Esa Ahola esa@cyclone.atl.ga.us / emory!cyclone!esa / CIS:70012,2753