| | | StrataFrame User
       
Group: StrataFrame Users Last Login: Yesterday @ 9:46:15 PM Posts: 288, Visits: 1,135 |
| Thanks Trent, points taken.
Edhy RijoProgytech (Computer Consultants) |
| | | | 
StrataFrame Novice
       
Group: StrataFrame Users Last Login: Yesterday @ 6:22:41 PM Posts: 106, Visits: 392 |
| | I certainly defer to you experience regarding using guids with newid() in SF. In vfp/vfe I would use guids because generating the key on the front end saved a trip to the server before populating child fks and I often had situations where tables were going to be merged or data moved around among numerous installations of a program. But I do see the problems - and the problems regarding using UID with a clustered index are obvious. I am very impressed with the way SF seems to give the best of both worlds in one sense - handling the fk thing with integer keys with no problem. Does the newsequentialid() function in SQL 2005 change any of the thinking about considering use of UIDs? would it be difficult to have newsequentialid() used to create UIDs on the back end? I'm pretty sure I'll be using Int keys in SF for the most part, but just wondered about the practicality of sequential UIDs ? http://www.fotia.co.uk/fotia/DY.19.NewSequentialId.aspx |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 3:24:00 PM Posts: 3,733, Visits: 3,926 |
| Does the newsequentialid() function in SQL 2005 change any of the thinking about considering use of UIDs? would it be difficult to have newsequentialid() used to create UIDs on the back end? This isn't the issue. The issue is not when creating the PK, but rather when performing queries on the data. In VFP we used to use Integer PKs which was extremely frustrating because they did not have the AutoInc stuff when we started (and their AutoInc is nowhere in the same universe as SQL Server). However, since we used Integer PKs life did get much better once we got on SQL Server and did not have to convert from GUIDs to Integer PKs. But back to the original point, the issue is not when creating the PK. If you want to use a GUID PK, don't let the server assign it, just call the System.Guid.NewGuid() method in the SetDefaultValues of the business object versus relying on the server. It is basically impossible to get two GUIDs of the same uniqueness anyway. When using identiy fields in SQL Server, the BO has the ability to automatically retrieve the PK once a new record is created, which I am sure that you have already discovered. So the issue isn't the whole NextId() thing that you faced in VFP, but rather when you start to query the data to retrieve records within the DB. Hope that makes sense  |
| | | | StrataFrame Novice
       
Group: StrataFrame Users Last Login: 2 days ago @ 7:04:50 PM Posts: 61, Visits: 147 |
| | Very interesting performance information about GUIDs which is a concern as we were looking to migrate to GUIDs from int PKs. We have a legacy system that involves many distributed databases per customer. All databases must be updatable even if the WAN connection is down. As a result, our int PKs must be globally unique which is why we have to update the PKs from the application. We had planned on migrating to a new database model that used GUIDs but these performance figures are worrying. Unfortunately, our PKs must be globally unique across all databases and other than the performance problem, GUIDs looked the easiest option for an automatic solution rather than our manual int solution. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 3:24:00 PM Posts: 3,733, Visits: 3,926 |
| | In your case I would probably go with GUIDs so that you do not have to engineer the global PKs. When weighing the costs between the two the ease of the GUIDs would win out in my eyes as we have tried to engineer the other behavior in more than one instance and it always ends up out of sync at some point which causes issues. This would fall under the replication category that Paul was talking about earlier. |
| | | | StrataFrame Novice
       
Group: StrataFrame Users Last Login: 2 days ago @ 7:04:50 PM Posts: 61, Visits: 147 |
| | I think you are right Trent. Whatever way we have tried to engineer it, it still results in conflicts somewhere down the line. Of course, that leaves us with a real headache as we have a large no of customer databases that need to be converted from the old legacy database running with int PKs to a revised database with GUIDs PK. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: Yesterday @ 9:46:15 PM Posts: 288, Visits: 1,135 |
| | Hi Aaron, I have a VFP application installed in 17 branches which synchronize to the main office. My solution was to used GUID PK and a BranchID field, the GUID works just find and in the main office where all the repository is there has not been performance issues because all the fields are properly indexed and the generation of reports is normal. I should note that the synch process is one way only from branches to the main office and that may not be your case. So if I would have to do this project in SF I would need to re-think the logic since instead of synchronizing I would have all branches connected to the main office database using SF Enterprise server, but still using the GUID PK.
Edhy RijoProgytech (Computer Consultants) |
| | | | StrataFrame Novice
       
Group: StrataFrame Users Last Login: 2 days ago @ 7:04:50 PM Posts: 61, Visits: 147 |
| | Hi Edhy, That is good to know. We have tested with GUIDs to a limited degree and it looked okay but our big problem will be converting legacy databases to a new format. Some of the databases are literally in use 24x7x365. But I guess that problem is for another day. |
| | | |
|