Database identity VS. Servoy sequence

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

Database identity VS. Servoy sequence

Postby deezzub » Tue Jun 17, 2014 12:42 pm

I first used the database identity as a unique identifier, after I found a bug in Servoy, I switched to Servoy sequence. I would like to know, if this can have any sideffects? Is the server generating the Servoy sequences for the connected clients?

Is the Servoy sequence unique, if for example 2 connected clients create new records at the same time?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Database identity VS. Servoy sequence

Postby Harjo » Tue Jun 17, 2014 1:41 pm

1. yes, the sequence is done serverside, and the servoy-repository is keeping track, of the sequencenumbers per table
2. unique? It better be! :shock: :lol: or else we would run into trouble 10 years ago! ;-) (Using servoy sequences ever since, with Firebird, Sybase and now PostgreSQL, without ANY issues!)

Be aware, that using servoy-sequences, the databases can't be altered outside Servoy, or else your sequence's become out of sync!
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Database identity VS. Servoy sequence

Postby david » Tue Jun 17, 2014 2:55 pm

UUID IDs is the only way to go! No reseting sequences, can modify tables outside of Servoy, export/import a breeze, can easily split/combine like tables (SaaS task), etc.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Database identity VS. Servoy sequence

Postby ROCLASI » Wed Jun 18, 2014 10:24 am

david wrote:UUID IDs is the only way to go!

In fact there is a strong opinion for and against using UUID as PK's.
In the end it all comes down to what your use-case is and can you live with the downside of either option.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Database identity VS. Servoy sequence

Postby Harjo » Wed Jun 18, 2014 2:06 pm

We too are still not convinced if using UUID as PK's, is the road to go....
Still not clear, what the consequences are with a large SaaS solution, containing tables with thousands (millions) of records
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Database identity VS. Servoy sequence

Postby david » Wed Jun 18, 2014 4:05 pm

ROCLASI wrote:
david wrote:UUID IDs is the only way to go!

In fact there is a strong opinion for and against using UUID as PK's.
In the end it all comes down to what your use-case is and can you live with the downside of either option.


10 years ago there were two valid sides to this decision. Now UUID for PK is a best practice except for a few rare edge cases. If you're in this territory then it is very unlikely you would be developing this app with Servoy.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Database identity VS. Servoy sequence

Postby ngervasi » Wed Jun 18, 2014 4:12 pm

UUIDs are sexy but are very difficult to handle during debugging (integer pks easily show records creation order and are easy to spot when debugging), another concern is about performance if you have very large tables.
David, are you experiencing any performance issue on queries? Especially joins?
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: Database identity VS. Servoy sequence

Postby david » Wed Jun 18, 2014 4:51 pm

ngervasi wrote:UUIDs are sexy but are very difficult to handle during debugging (integer pks easily show records creation order and are easy to spot when debugging), another concern is about performance if you have very large tables.
David, are you experiencing any performance issue on queries? Especially joins?


All total bunk :) In what cases is the PK type a query performance consideration? If you know this answer, why are you developing in Servoy? And I had a developer not long ago state that they were using integers instead of UUIDs because they were easier to remember and type when debugging. This is not a valid reason!

SaaS, sharing data, syncing offline data, distributed data, multiple applications on same data, security, no maintaining uniqueness overhead, no scaling issues, multi-threaded ok, mobile friendly, cloud friendly, database vendor agnostic, unique across tables...these are valid reasons.

Auto-increment integers didn't have to deal with all these situations back in the day. And nowadays with compression implemented by many databases, UUID space cost is negligible.

Many of the new db's in the past handful of years don't even have auto-increment integer PKs as an option.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Database identity VS. Servoy sequence

Postby Harjo » Wed Jun 18, 2014 5:00 pm

david wrote:UUID space cost is negligible.

Space is not the issue, performance is!!
Nobody (sofar) can show real figures what the impact or difference is in performance with large scaled databases!
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Database identity VS. Servoy sequence

Postby david » Wed Jun 18, 2014 5:17 pm

Harjo wrote:
david wrote:UUID space cost is negligible.

Space is not the issue, performance is!!
Nobody (sofar) can show real figures what the impact or difference is in performance with large scaled databases!


Space cost historically is the classic main debate issue. Space can still be an issue in certain types of deployments—but none that a Servoy app would used for.

Performance: exactly. "Large scaled databases"...note what type of PKs all the new databases in this category generate by default out of the box. Apparently they aren't worried about any performance issues with UUIDs.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Database identity VS. Servoy sequence

Postby ROCLASI » Thu Jun 19, 2014 12:16 am

Hi David,
david wrote:Now UUID for PK is a best practice except for a few rare edge cases.

Can you enlighten us with some citations of these best practices and use-cases?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Database identity VS. Servoy sequence

Postby ROCLASI » Thu Jun 19, 2014 12:24 am

Hi David,

david wrote:Many of the new db's in the past handful of years don't even have auto-increment integer PKs as an option.

Even MySQL (and yes, I see that as a lowest denominator in the RDBMS world) does support these auto-increment integer PK's.
And many of the 'new' (as in Not-Only-SQL) db's also don't support ACID. You make it sound that is always a good thing.
I disagree.
Again, it all depends on your use-case and the cost of the downside.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Database identity VS. Servoy sequence

Postby sbutler » Thu Jun 19, 2014 6:08 am

Database identity should be your first option. Your database is responsible for data integrity, so let it make the PK's

Servoy Sequences are a good choice if you are making a SaaS product to distribute on various database platforms for which you may not have full say in how the backend is managed. In other words, I you don't control the DB, then let your app do the work.

UUID's are good if you want some kind of offline syncing. This should be your last choice as it comes with high performance costs. Integer PK's can fit into memory easier and the index cluster handles them better.

Back to your original reason for switching from Database sequences. Normally foundset.sort issues a db query, so unsaved records would get dropped. According to your example, you passing a custom function into foundset.sort, so I'd say you did find a bug. Usually Servoy is pretty good about fixing real bugs like that. So, if you can hold off a bit, I'd suggest continuing to use Database Identities, and wait until Servoy fixes the bug.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Database identity VS. Servoy sequence

Postby david » Thu Jun 19, 2014 3:49 pm

ROCLASI wrote:
david wrote:Many of the new db's in the past handful of years don't even have auto-increment integer PKs as an option.

Even MySQL (and yes, I see that as a lowest denominator in the RDBMS world) does support these auto-increment integer PK's.
And many of the 'new' (as in Not-Only-SQL) db's also don't support ACID. You make it sound that is always a good thing.
I disagree.
Again, it all depends on your use-case and the cost of the downside.


I give a bunch of reasons for why I think it should be the default choice for business applications. Any reasons for integer PKs? Throw 'em out for debate. Another one for UUIDs: sharing data amongst multi-developer teams.

goldcougar wrote:UUID's are good if you want some kind of offline syncing. This should be your last choice as it comes with high performance costs. Integer PK's can fit into memory easier and the index cluster handles them better.


Now we're into an area that requires some thought. But apparently not black and white: http://inessential.com/vespersyncdiary. He ended up using UUIDs.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Database identity VS. Servoy sequence

Postby Bernd.N » Thu Jun 19, 2014 6:58 pm

A most interesting thread, and it reminds me on discussions between fellow students in a canteen if Atari is the best computer or not. Most believed that the computer they currently used was the best. :)
But back to topic. I just googled “uuid performance” and found an interesting article written 2007 from MySQL guru Peter Zaitsev, who made some performance testing where integers were much faster for a large table with 268 million rows (200 times performance difference):
http://www.mysqlperformanceblog.com/200 ... t-to-uuid/

Actually, there are tons of articles for "uuid performance", therefore I think we should not fighting tooth and nail about this theme that others discussed so much already.

Without being aware of this thread, I asked by chance today if I should use an integer at least for the most important tenant_id in each table, while using UUID as PK for all tables in general.

ngervasi wrote:UUIDs are sexy but are very difficult to handle during debugging (integer pks easily show records creation order and are easy to spot when debugging)

Patrick Ruhsert told me that the record creation order can easily be done with the standard field creation_date, which most use anyway.

I agree to the advantage of integer PKs for debugging. I had cases where I just asked customers to give me the ID of a record that has a problem on phone. So identifying a record is much simpler. Therefore I am currently planning to use both a UUID as PK and a sequenced integer as user-friendly ID for communication about a specific record. I do not want to horrify my users by showing them a UUID.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 544
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Next

Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 10 guests

cron