Posts

Memory is a new disk

Image
In the database world, disk based data stores are slowly being replaced by memory-based data stores. Memory prices are becoming more affordable and operational databases can usually fit totally into memory. According to the Gartner (the research company that provides independent technology reports) by the end of 2015 all enterprise DBMS will use memory optimizations and most of this  transformation will happen this year.  I am playing with the Hekaton tables these days and thinking to whom of my customers it might be relevant. Most of them prefer the new stuff and are quite eager to put new terms on their CV. They like to say “Why SQL Server? Everyone is using Redis as an in-memory database, it’s free and working blazingly fast. And the other department is using the Couchbase cluster. We don’t want to stay behind…” In such situations I need to step outside of the wardrobe where I’m hiding and peek around. The DBMS market keeps growing and many great new technologies are b...

The Distributor. Think and Rethink every thing.

Image
The key player in the transactional replication topology is the Distributor. Misconfiguration of the Distributor can lead to increased load on the production server, can interfere with the regular application activities and even cause production databases to become inaccessible. In addition, its configuration greatly impacts the replicated data latency. Changing the Distributor’s configuration after setting up the replication can be problematic and can impact application activity. The main aspects to be considered when planning a replication design are: Number of publications on each publisher in the future replication topology EPS in the replicated tables Number of planned publishers Distance between Publisher, Distributor and Subscribers Number of subscribers for each publication Size of the published Databases Most of the answers to the above questions will lead to the the decision whether you want to have a dedicated Distributor server or configure the Publisher or the...

Choosing SEQUENCE instead of IDENTITY? Watch your step.

Image
On the nice sunny day getting this error message can be really frustrating. In fact, it is frustrating on any day. Especially if you are doing something really simple. Most of you at this moment yell at your monitor “DDL Trigger!!!!” . Yes. I have a simple DDL trigger for auditing purposes. If you use the script below for the auditing table, any DDL statement will get pretty red notification to discard the results. CREATE DATABASE  TestDB ; USE  TestDB ; CREATE  SEQUENCE  GetNextNumber  AS  int  START  WITH  1 INCREMENT  BY  1 ; CREATE  TABLE  dbo . TestAuditTable (         ID             int  NOT  NULL  DEFAULT  NEXT  VALUE  FOR  GetNextNumber  PRIMARY  KEY ,         ChangeDate     datetime ,  ...

Grouping events into intervals using hedgehog rolling style

Image
- I have a challenging SQL problem for you, – yelled one of my coworkers one morning entering my office and dropping on his way a few pictures, SQL server system views map and a visitors chair. – Much more interesting than all your alerts and twitter conversations! ( “Well”, I thought to myself, “it might beat the alerts but not the twitter conversations” ) The problem presented by him is as follows: There is a table containing information about a device’s, like phones or tablets, history of connections to hotspots as shown below: The idea was to bind together the above mentioned events into groups. Each group, or we can call it - an interval, should represent the time that any device was connected to the specific access point. Each time the device has moved to the new access point, a new interval should start. If there were no events for the specific device longer than 30 min, the next event should start a new interval even if the new event was reported on the same access p...