Re: [sqlite] Changing ID's to UUID

2016-11-18 Thread James K. Lowden
On Fri, 18 Nov 2016 10:22:15 -0800 Jens Alfke wrote: > You?d have to assign a central ?count server? to hand out consecutive > numbers No. You need only enumerate the sources, and accept that the key is the unique counter from the source plus the centrally assigned source

Re: [sqlite] Changing ID's to UUID

2016-11-18 Thread Jens Alfke
> On Nov 16, 2016, at 5:59 AM, Keith Medcalf wrote: > > What I do not understand is why one would use a UUID (randomly generated > bunch of bytes) as a key in a database. It is long, every use must be > checked for collisions, and inherently far less efficient than the

Re: [sqlite] Changing ID's to UUID

2016-11-17 Thread Richard Damon
On 11/17/16 6:10 AM, R Smith wrote: On 2016/11/17 10:48 AM, J Decker wrote: https://en.wikipedia.org/wiki/Birthday_problem /.../ one duplicate. In other words, only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be

Re: [sqlite] Changing ID's to UUID

2016-11-17 Thread R Smith
On 2016/11/17 10:48 AM, J Decker wrote: https://en.wikipedia.org/wiki/Birthday_problem /.../ one duplicate. In other words, only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%. All correct, but sounding

Re: [sqlite] Changing ID's to UUID

2016-11-17 Thread J Decker
Re Integer shorness... UUID does seem wasteful - to have to ccompare such a long value. But the string compare will often fail within the first 4 bytes, or less, making many comparisons less 'work' than an integer of the same... since sqlite stores everything as text if you are in 123,000,000..

Re: [sqlite] Changing ID's to UUID

2016-11-17 Thread J Decker
https://en.wikipedia.org/wiki/Birthday_problem In probability theory , the *birthday problem* or *birthday paradox *[1] concerns the probability

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Simon Slavin
On 17 Nov 2016, at 3:13am, Keith Medcalf wrote: > You would only get guaranteed collision avoidance if you kept track of every > UUID issued and checked for duplicates at time of issue to avoid duplication > by keeping a list of all the "used" identifiers. I do not think

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Keith Medcalf
> As someone mentioned in a different part of this thread, the issue is > centralization. If you have multiple decentralied machines generating > UUIDs you *could* have collisions, but if you pick your UUID scheme well > enough collisions will be extremely rare, on par with things like data >

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Nico Williams
On Wed, Nov 16, 2016 at 02:51:35PM -0600, Jeffrey Mattox wrote: > I think this discussion is about apples and oranges. UUID stands for > universally UNIQUE identifier, so there won't be any collisions. It > looks random, but it never repeats. [...] No, DRH is right that this depends on how

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread David Raymond
ID's we have over there? -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Jeffrey Mattox Sent: Wednesday, November 16, 2016 3:52 PM To: SQLite mailing list Subject: Re: [sqlite] Changing ID's to UUID I think this discussion i

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Jeremy Brown
On Wed, Nov 16, 2016 at 02:51:35PM -0600, Jeffrey Mattox wrote: > On Nov 16, 2016, at 8:46 AM, Richard Hipp wrote: > > > >> On 11/16/16, Keith Medcalf wrote: > >> What I do not > >> understand is why one would use a UUID (randomly generated bunch of bytes)

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Jeffrey Mattox
On Nov 16, 2016, at 8:46 AM, Richard Hipp wrote: > >> On 11/16/16, Keith Medcalf wrote: >> What I do not >> understand is why one would use a UUID (randomly generated bunch of bytes) >> as a key in a database. It is long, every use must be checked for >>

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread James K. Lowden
On Wed, 16 Nov 2016 08:59:03 -0600 Paul Egli wrote: > > Using the systemid sequence and the recordid sequence directly > > however, has a 0% probability of collision, so any rational person > > would use that directly and forgo entirely the introduction of > > uncertainty

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Paul Egli
On Wed, Nov 16, 2016 at 7:59 AM, Keith Medcalf wrote: > Using the systemid sequence and the recordid sequence directly however, > has a 0% probability of collision, so any rational person would use that > directly and forgo entirely the introduction of uncertainty and bugs

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Richard Hipp
On 11/16/16, Keith Medcalf wrote: > What I do not > understand is why one would use a UUID (randomly generated bunch of bytes) > as a key in a database. It is long, every use must be checked for > collisions, and inherently far less efficient than the simple integer >

Re: [sqlite] Changing ID's to UUID

2016-11-16 Thread Keith Medcalf
> > I still cannot fathom why anyone would assign random numbers or (even > more useless) long random blobs to use as psuedo-keys. It just boggles > the mind. > I take it you’re not a cryptographer :) All modern ciphers do this. For > example, an RSA key pair is simply a pair of large random

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Hick Gunter
On Tuesday, 15 November, 2016 15:30, R Smith wrote: > >> On 2016/11/15 10:38 PM, Jens Alfke wrote: > >> >> On Nov 15, 2016, at 11:35 AM, Quan Yong Zhai wrote: > >> >> Create a custom function MD5 , >> > If you’re going to go to this trouble, at least use SHA256! >> > >> > MD5 is

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Jens Alfke
> On Nov 15, 2016, at 1:11 PM, Scott Robison wrote: > > Completely depends on your needs. If your needs are not cryptographic, then > there is no problem. But there’s little reason to use MD5 instead of SHA-1; they’re roughly the same speed, but SHA-1 is considerably

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Dominique Devienne
> I still cannot fathom why anyone would assign random numbers or (even more > useless) long random blobs to use as psuedo-keys. > Because it is decentralized. You can assign random uuids as immutable surrogate keys to your entities without going to the db for a sequence based integer sk. And

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Keith Medcalf
On Tuesday, 15 November, 2016 15:30, R Smith wrote: > On 2016/11/15 10:38 PM, Jens Alfke wrote: > >> On Nov 15, 2016, at 11:35 AM, Quan Yong Zhai wrote: > >> Create a custom function MD5 , > > If you’re going to go to this trouble, at least use SHA256! > > > > MD5 is broken.

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread R Smith
On 2016/11/15 10:38 PM, Jens Alfke wrote: On Nov 15, 2016, at 11:35 AM, Quan Yong Zhai wrote: Create a custom function MD5 , If you’re going to go to this trouble, at least use SHA256! MD5 is broken. These days no one should be using it for anything, except when needed for

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Scott Robison
On Tue, Nov 15, 2016 at 1:38 PM, Jens Alfke wrote: > > > On Nov 15, 2016, at 11:35 AM, Quan Yong Zhai wrote: > > > > Create a custom function MD5 , > > If you’re going to go to this trouble, at least use SHA256! > > MD5 is broken. These days no one should be

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Jens Alfke
> On Nov 15, 2016, at 11:35 AM, Quan Yong Zhai wrote: > > Create a custom function MD5 , If you’re going to go to this trouble, at least use SHA256! MD5 is broken. These days no one should be using it for anything, except when needed for compatibility with legacy

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Quan Yong Zhai
Windows Phone 发件人: Cecil Westerhof<mailto:cldwester...@gmail.com> 发送时间: ‎2016/‎11/‎15 16:03 收件人: SQLite mailing list<mailto:sqlite-users@mailinglists.sqlite.org> 主题: [sqlite] Changing ID's to UUID I have several tables where a numeric ID is used. I want

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Richard Hipp
On 11/15/16, Jens Alfke wrote: > > SQLite documentation does not describe which > random number generator is used; it just calls it “pseudo-random”. The SQLite PRNG uses RC4 and is seeded from /dev/random (on unix - the seeding on windows is not as good). So randomblob()

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Jens Alfke
> On Nov 15, 2016, at 3:02 AM, Simon Slavin wrote: > > SQLite has a randomblob function which can be used to select part of the > UUID, but you need to pick a UUID scheme suitable for your purposes to know > how much of it can be random. In some use cases it’s important

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Simon Slavin
On 15 Nov 2016, at 12:59pm, Cecil Westerhof wrote: >> SQLite has a randomblob function which can be used to select part of the >> UUID, but you need to pick a UUID scheme suitable for your purposes to know >> how much of it can be random. > > That is something to look

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Cecil Westerhof
2016-11-15 12:02 GMT+01:00 Simon Slavin : > > On 15 Nov 2016, at 8:03am, Cecil Westerhof wrote: > >> I have several tables where a numeric ID is used. I want to change >> those to UUID's. Is there a smart way to do this, or need I to do this >> one by

Re: [sqlite] Changing ID's to UUID

2016-11-15 Thread Simon Slavin
On 15 Nov 2016, at 8:03am, Cecil Westerhof wrote: > I have several tables where a numeric ID is used. I want to change > those to UUID's. Is there a smart way to do this, or need I to do this > one by one? I think you'll have to do it in software. SQLite has a

[sqlite] Changing ID's to UUID

2016-11-15 Thread Cecil Westerhof
I have several tables where a numeric ID is used. I want to change those to UUID's. Is there a smart way to do this, or need I to do this one by one? -- Cecil Westerhof ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org