sqldownunder  

RE: Guids vs Integers for primary keys? Performance?

Kirsten Greed
Sat, 04 Feb 2012 18:26:09 -0800

Hi Greg

Um what types are there?

I was hoping for the user experience to be that they hit a refresh button
and an asynch process pulls down data that other users have added and puts
up new data that the user has added.

 

Although that might be ambitions I was wondering just how ambitious it is

Is it similar to database replication?

Thanks

Kirsten

 

  _____  

From: sqldownunder-boun...@list.sqldownunder.com
[mailto:sqldownunder-boun...@list.sqldownunder.com] On Behalf Of Greg Low
(GregLow.com)
Sent: Sunday, 5 February 2012 11:41 AM
To: 'SQLDownUnder'
Subject: RE: Guids vs Integers for primary keys? Performance?

 

Hi Kirsten,

 

What type of synching are you trying to achieve?

 

Regards,

 

Dr Greg Low

 

1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax


SQL Down Under | Web:  <http://www.sqldownunder.com/> www.sqldownunder.com

 

From: sqldownunder-boun...@list.sqldownunder.com
[mailto:sqldownunder-boun...@list.sqldownunder.com]
<mailto:%5bmailto:sqldownunder-boun...@list.sqldownunder.com%5d>  On Behalf
Of Kirsten Greed
Sent: Sunday, 5 February 2012 9:21 AM
To: 'SQLDownUnder'
Subject: RE: Guids vs Integers for primary keys? Performance?

 

Hi Nick, Greg, Dave

Thanks for your help.

I am feeling inspired to stay away from Guids as primary keys.

The application is a business app with several tables having hundreds of
thousands of records.

 

I am wondering about tools for syncing?

Dave's comments that I need to carefully plan things out, and Greg's about
having a table that maps between synchronised tables makes me think that the
sync framework is not a candidate.

 

Kirsten

 

  _____  

From: sqldownunder-boun...@list.sqldownunder.com
[mailto:sqldownunder-boun...@list.sqldownunder.com]
<mailto:%5bmailto:sqldownunder-boun...@list.sqldownunder.com%5d>  On Behalf
Of Nicholas Kavadias
Sent: Saturday, 4 February 2012 5:29 PM
To: SQLDownUnder
Subject: RE: Guids vs Integers for primary keys? Performance?

 

My 2 cents:
If you do decide on guids, use newsequentialid() to generate values
http://www.fotia.co.uk/fotia/DY.19.NewSequentialId.aspx
Enjoy the rest of your weekend.
Nick

On Feb 4, 2012 4:41 PM, "Greg Low" <g...@solidq.com> wrote:

The other main thing is that there often seems to be a presumption that you
have to have your logical data model the same as your physical data model.
You don't.

 

For example, rather than having all your tables that have a customer ID
having the GUID, you can always have ints or bigints all over the place, and
just have one table that maps between them.

 

Regards,

 

Greg

 

Dr Greg Low | SolidQ | +61.4.1920.1410 <tel:%2B61.4.1920.1410>  mobile |
+61.3.8676.4913 <tel:%2B61.3.8676.4913>  fax

 

From: sqldownunder-boun...@list.sqldownunder.com
[mailto:sqldownunder-boun...@list.sqldownunder.com] On Behalf Of Dave Dustin
Sent: Saturday, 4 February 2012 4:22 PM
To: 'SQLDownUnder'
Subject: Re: Guids vs Integers for primary keys? Performance?

 

Everybody must be out relaxing in the sun given the lack of responses...

 

If you're considering using GUIDs as the primary key, please DO NOT make
them also the Clustered index unless you want to take a SERIOUS performance
hit.

 

Using GUIDs for linking is a commonly implemented pattern, but you need to
plan it out in advance.  
- What will be generating the GUID, the app or the database?  

- How many rows are you looking at?  A GUID (stored as a UNIQUEIDENTIFIER)
will consume 16bytes.  An INT (most common IDENTITY datatype) is only 4.
You'll need to take that into account when planning indexes and database
diskspace requirements...

- There may be an overhead for CASTing between the database and the
application when passing the GUID around, depending what format it's being
delivered in.

 

 

 

Cheers

 

Dave

 

 

From: Kirsten Greed <mailto:kirst...@jobtalk.com.au>  

Sent: Saturday, February 04, 2012 1:59 PM

To: 'SQLDownUnder' <mailto:sqldownunder@list.sqldownunder.com>  

Subject: Guids vs Integers for primary keys? Performance?

 

Hello All

I want to make my application work in an occasionally connected mode and am
thinking of the Sync Framework as the way to do it.

However I currently use identity primary keys and would probably need to
change to using GUIDS as primary keys

Many of my queries involve 5 or more tables - should I expect much of a
performance hit if I make the change?
Thanks

Kirsten

 

 

  _____  

_______________________________________________
sqldownunder mailing list
sqldownunder@list.sqldownunder.com
http://prdlxvm0001.codify.net/mailman/listinfo/sqldownunder


_______________________________________________
sqldownunder mailing list
sqldownunder@list.sqldownunder.com
http://prdlxvm0001.codify.net/mailman/listinfo/sqldownunder



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 6777 (20120108) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

_______________________________________________
sqldownunder mailing list
sqldownunder@list.sqldownunder.com
http://prdlxvm0001.codify.net/mailman/listinfo/sqldownunder