Im working on an application which access a Sybase ASE 15.0.2 ,where the current code access a remote database (CIS) to insert a row using a proxy table definition (the destination table is a DOL - DRL table - The PK row is defined as identity ,and is always growing). The current code performs a select to check if the row already exists to avoid duplicate data to be inserted.
Since the remote table also have a PK definition on the table, i do understand that the PK verification will be done again prior to commiting the row. Im planning to remove the select check since its being effectively done again by the PK verification, but im concerned about if when receiving a file with many duplicates, the table may suffer some unecessary contention when the data is tried to be commited.
Its not clear to me if Sybase ASE tries to hold the last row and writes the data prior to check for the duplicate. Also, if the table is very big, im concerned also about the time it will spend looking the whole index to find duplicates.
I've found some documentation for SQL anywhere, but not ASE in the following link http://dcx.sybase.com/1200/en/dbusage/insert-how-transact.html
The best i could find is the following explanation
https://groups.google.com/forum/?fromgroups#!topic/comp.databases.sybase/tHnOqptD7X8
But it doesn't enlighten in details how the row is locked (and if there is any kind of optimization to write it ahead or at the same time of PK checking) , and also if it will waste a full PK look if im positively inserting a row which the PK positively greater than the last row commited
Thanks
Alex