Numeric datatypes as primary key in databases

Most likely primary keys in databases are numbers. But what happens, when an administrator uses the wrong numeric data type? In the worst case, databases can’t write down entries anymore.

For example, if an administrator wants to write customer information into the databases and wants to use the customerID itself as the primary key, then the numeric data type “TINYINT” would cause that only 255 entries can be written. But on the other hand the “BIGINT” numeric data type, could be too large for smaller databases.
So when you are setting up a database, you should think about how many entries will be written the next months/years and think about which datatype is the right one for your setup. Also you should think about if you should use the data types unsigned or not. This value will change the range of the datatypes.

Typ signed unsigned
Min Max Min Max
TINYINT -128 +127 0 255
SMALLINT -32.768 +32.767 0 65.535
MEDIUMINT -8.388.608 +8.388.607 0 16.777.215
INT/INTEGER -2.147.483.647 +2.147.483.646 0 4.294.967.295
BIGINT -263 +263 – 1 0 264 – 1

Another example:
If an administrator wants to store 60000 customer information in the database, he should use at least a “SMALLINT”. Should he use the unsigned version or not? Lets have a look.
With the signed data type he has a range from -32.768 up to +32.767, but no customerID (primary key as mentioned above) has a negative number, so a “unsigned SMALLINT” would be necessary.

The case, that you thought about the questions above but your data type got out of range, could happen. There is a way to change the datatype and to increase the range in a simple way.
*ALTER TABLE tablename MODIFY column MEDIUMINT UNSIGNED;*
But remember: The larger your database is, the longer will it take to do such changes!

Marius Gebert

Autor:

Marius ist seit September 2013 bei uns beschäftigt. Er hat im Sommer 2016 seine Ausbildung zum Fachinformatiker für Systemintegration absolviert und kümmert sich nun um den Support unserer Hostingkunden. Seine besonderen Themengebiete erstrecken sich vom Elastic-Stack bis hin zu Puppet. Auch an unserem Lunchshop ist er ständig zu Gange und versorgt die ganze Firma mit kulinarischen Köstlichkeiten. Seine Freizeit verbringt Marius gern an der frischen Luft und wandert dabei durch die fränkische Schweiz

OSDC 2017 – Update

From 16.-18. May 2017, the Open Source Data Center Conference will take place in Berlin.
After fixing the hands-on workshops on the first day of the conference, our program is beginning to take shape. Most of our speakers are fixed, so take a look, what awaits you this year.
There will be some great talks on the topics CONTAINERS, INFRASTRUCTURE AS CODE, INTEGRATION and DEPLOYMENT.

The program will be completed within the next few days.

As usual, there will be a relaxed evening event to meet each other in a casual setting.

As always, we are especially grateful to our sponsors, without whose continued support this conference would not be possible.

There’s the Thomas.Krenn AG who supported our conferences for many years now, and we’re happy to know, that they’re sponsoring this year’s OSDC again.

Furthermore we thank the Admin Magazine as well as the Linux Magazin for our media partnership.

Julia Hackbarth

Autor: Julia Hackbarth

Julia ist seit 2015 bei NETWAYS. Sie hat im September ihre Ausbildung zur Kauffrau für Büromanagement gestartet. Etwas zu organisieren macht ihr großen Spaß und sie freut sich auf vielseitige Herausforderungen. In ihrer Freizeit spielt Handball eine große Rolle: Julia steht selbst aktiv auf dem Feld, übernimmt aber auch gerne den Part als Schiedsrichterin.

Running RedHat SCL PostgreSQL with Puppet

On a test system for a customer I wanted to bring up a newer PostgreSQL version on CentOS 7 (same for RHEL 7). Software Collections (also for RedHat) gives you a neat distribution method that is not very invasive into your existing distribution. So you can install a PostgreSQL 9.4 under RHEL 7 without replacing any of the existing packages. This is a bit tricky in terms of paths, but just works.

I found a relatively simple way to install, configure and run such a SCL with Puppet, with just using the existing PostgreSQL module.

Have fun trying it out and let me know what you think.

Markus Frosch

Autor: Markus Frosch

Markus arbeitet bei NETWAYS als Principal Consultant und unterstützt Kunden bei der Implementierung von Nagios, Icinga und anderen Open Source Systems Management Tools. Neben seiner beruflichen Tätigkeit ist Markus aktiver Mitarbeiter im Debian Projekt.

First speakers and workshops for the OSDC 2017 announced!

We proudly present our first speakers who will give interesting talks on topics concerning Open Source Data Center solutions.
We’re happy to welcome

…and much more!

In addition, we defined our three workshops that can be booked additionally.

The workshops will be held in a small group, to guarantee an optimal training effect to our attendees. So it is therefore recommended to get your tickets as early as possible.

Be part of the OSDC in Berlin – The conference on application of open source software in data centers and huge IT environments.

We’re looking forward to welcoming you!

Julia Hackbarth

Autor: Julia Hackbarth

Julia ist seit 2015 bei NETWAYS. Sie hat im September ihre Ausbildung zur Kauffrau für Büromanagement gestartet. Etwas zu organisieren macht ihr großen Spaß und sie freut sich auf vielseitige Herausforderungen. In ihrer Freizeit spielt Handball eine große Rolle: Julia steht selbst aktiv auf dem Feld, übernimmt aber auch gerne den Part als Schiedsrichterin.

Do not put off till tomorrow…

… what you can do today. For example to submit your proposal for a talk at the Open Source Data Center Conference, taking place on May 16 to 18, 2017 in Berlin. Above all, you can save a lot of money! Until January 31st you can still get your early bird ticket (€100 cheaper!)!

Until the end of January, interested speakers have the opportunity to submit their presentations and case studies proposals via the Call for Papers form at the conference website. So be part of the conference on Open Source Data Center solutions and give the conference a special touch.

The central aspect of the conference is the exchange of experiences between participants, as well as meeting the open source community. Expect lots of new know-how, latest developments and hot discussions about the application of open source software solutions in the field of data centers and huge IT environments. As always, additional workshops on various topics are offered the day prior to the conference.

So now it is your turn to submit your proposal! Be part of the conference and make the OSDC 2017 unique.

Julia Hackbarth

Autor: Julia Hackbarth

Julia ist seit 2015 bei NETWAYS. Sie hat im September ihre Ausbildung zur Kauffrau für Büromanagement gestartet. Etwas zu organisieren macht ihr großen Spaß und sie freut sich auf vielseitige Herausforderungen. In ihrer Freizeit spielt Handball eine große Rolle: Julia steht selbst aktiv auf dem Feld, übernimmt aber auch gerne den Part als Schiedsrichterin.

May I introduce the Rubocop

When you are into developing Ruby code, or even Ruby near stuff like Puppet modules, or Chef cookbooks, there is a nice tool you should have a look at.

The RuboCop can help you writing better Ruby code, it certainly did it for me.

In short words, RubyCop is a code analyzer that checks Ruby code against common style guidelines and tries to detect a lot of mistakes and errors that you might write into your code.

There are a lot of configuration options, and even an auto-correct functionality, that updates your code.

Simple usage

Either install the gem, or add it to your Gemfile:

gem 'rubocop', require: false

You can just run it without configuration, and it will look for all Ruby files in your work directory.

$ rubocop
Inspecting 19 files
....C............CC

Offenses:

lib/test/cli.rb:3:3: C: Missing top-level class documentation comment.
 class CLI
 ^^^^^
lib/test/cli.rb:36:1: C: Extra empty line detected at method body beginning.
lib/test/cli.rb:41:1: C: Extra empty line detected at block body beginning.
lib/test/cli.rb:45:4: C: Final newline missing.
end
 
bin/test:12:1: C: Missing space after #.
#api.login('username', 'Passw0rd') unless api.logged_in?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bin/test:15:3: C: Missing space after #.
 #puts response.code
 ^^^^^^^^^^^^^^^^^^^
bin/test:19:1: C: Missing space after #.
#session.save(file)
^^^^^^^^^^^^^^^^^^^

18 files inspected, 7 offenses detected

You can add it as a rake job to your Rakefile:

require 'rubocop/rake_task'
RuboCop::RakeTask.new

task default: [:spec, :rubocop]

And run the test via your rake tests:

$ rake
$ rake rubocop

Configuration galore

There are a lot of options to modify the behavior and expectations of RuboCop.

Here is a short example I used with recent Puppet module.

require: rubocop-rspec
AllCops:
  TargetRubyVersion: 1.9
  Include:
    - ./**/*.rb
  Exclude:
    - vendor/**/*
    - .vendor/**/*
    - pkg/**/*
    - spec/fixtures/**/*

# We don't use rspec in this way
RSpec/DescribeClass:
  Enabled: False

RSpec/ImplicitExpect:
  Enabled: False

# Example length is not necessarily an indicator of code quality
RSpec/ExampleLength:
  Enabled: False

RSpec/NamedSubject:
  Enabled: False

Where to go next

Markus Frosch

Autor: Markus Frosch

Markus arbeitet bei NETWAYS als Principal Consultant und unterstützt Kunden bei der Implementierung von Nagios, Icinga und anderen Open Source Systems Management Tools. Neben seiner beruflichen Tätigkeit ist Markus aktiver Mitarbeiter im Debian Projekt.