pk

What's the purpose of sequental uniqueidentifier in PK of MS SQL?

I know that primary keys based on Guids do not have the best performance (due to the fragmentation), but they are globally unique and allow replication scenarios. Integral identifiers, on the other side, have greater performance at the cost of scalability. But in what scenarios would someone want to use sequential uniqueidentifier as t...

Change huge table PK column data type

Now that we've ran out of int capacity on a PK column (which is an IDENTITY) I'd like to do this to bigint, but simple ALTER TABLE seems to be unable to handle that big of a table. So my question is: how do I change the type of a PK column with keeping actual values in place and do I need to alter referencing tables as well? ...

Remove pk field from django serialized objects

I'm serializing a bunch of objects with: json = serializers.serialize("json", objects, fields=('name', 'country')) I have not included 'pk' in my fields list, but the produced JSON includes a primary key with each serialized object. I do not want my API to expose primary keys to the general public. Short of munging the output JSON, ...

Hibernate one-to-one entity association with shared PK between 3 classes

I want a unidirectional one-to-one relationship between objects of 3 java classes: Person to Heart, and Person to Liver. I want the objects to share the same PK i.e. every person has a corresponding heart and liver, where person.person_id = heart.heart_id = liver.liver_id. I do not want to merge the 3 tables into 1 because each has loads...

Nhibernate Guid with PK MySQL

Hello colleagues. I've got a question. I use NHibernate with MySql. At my entities I use Id(PK) for my business-logic usage and Guid(for replication). So my BaseDomain: public class BaseDomain { public virtual int Id { get; set; } public virtual Guid Guid { get; set; } public class Properties { public const str...

django blog - post- reply system display replies

I have a mini blog app, and a reply system. I want to list all mini blog entries, and their replies, if there are any. i have in views.py def profile_view(request, id): u = UserProfile.objects.get(pk=id) paginator = New.objects.filter(created_by = request.user) replies = Reply.objects.filter(reply_to = paginator...

SQL Primary key sort order

I am using MS SQL server 2005 I have a table with 3 columns where I store user-message mapping like: msg_for msg_from msg_id bob bob 1 bob john 1 bob steve 1 bob bob 2 bob john 2 bob bob 3 bob john 3 bob steve 3 The PK is on 3 columns and msg_id is FK to message...