Performance

Which attitude for hire?

In management world, you will often hear the following quote:

hire for attitude train for skills

The quote is good and hit the point. However even after you agree that attitude is better than skills for hiring people, knowing which “attitude” that are being mentioned in the quote is important. I will say that, without knowing the attitude that is mentioned in the quote, you better hire for skills instead.

In this article, I’ll use many references from Pawel Brodzinski. His writing is insightful and he is good at management. Moreover, he also had written one article titled “Why I Genuinely Want To Work With You“, a very similar with this one.

The essential attitude : Honest, open handed and cheerful

Essential attitude are useful in any kind of job.

For me, the very essential attitude, required and isn’t negotiable is honesty. A person I want to work with, or hire must be a honest person. Brodzinski also say that in business, the trust isn’t measurable. For me, honesty is the most important part in building trust. Dishonest person won’t make a great partner, and they will even make me work under suspicion and making me take extra step to prevent them stabbing me in the back.

The second essential attitude is open handed and willing to help, If they are willing to help me, I will do the same and am willing to help them. No matter how skilled someone is, if they are not willing to help, their ability won’t be much of use.

Last is cheerful. Why cheerful? A cheerful person will bring positive energy to workplace. They will brighten other employees and they can get more motivation and less stressed. In front-desk jobs, a cheerful person will be more liked by customers rather than a gloomy one. You wouldn’t want to work with a gloomy person, right? Worse if that gloomy person is your supervisor.

Note: There may be several disagreement about those three attitudes can be useful in any job. Ex: cheerful factory worker or honest sales. It is conditional though and can be interpreted differently. Ex: the sales is honest to the company and only do small lies to the customer, or cheerful factory worker can be serious at working and fun at break time.

The job-supporting attitude

Different job need different supporting attitude. That’s why you cannot determine that an attitude will be useful for any line of job, even if the attitude is positive one. For example: a manager or CEO will need to have innovative and creative thinking attitude, while a factory worker need not to have that attitude. A non-innovative or non-creative factory worker is better than innovative one, because they can follow order and won’t complain about the current system. It’s cruel I know, but it’s what the business needs.

The same is applied with the so-called good attitude: “hard worker” and “can work under pressure”. Both of them has very specific appliances and not all line of jobs benefit from them. Managers that is “hard worker” usually cannot manage well. They often do the work themselves and leading to micromanagement. If not, they usually prefer hard-worker staff, resulting in overtime, reduced employee happiness and reduced employee creativity and problem solving skill.

In programming world, they don’t need the “can work under pressure” attitude while most company stated that they need programmer with that kind of attitude. I don’t really understand the reasoning behind it. Unless the software they are developing is used in military, nuclear plants, airplanes or anything that can involve life beings, there won’t be any meaningful pressure.

Michelangelo, talent is cheap, dedication is costly!
– Bertoldo de Giovanni

For every job that need skill refinery such as smiting, music, crafting to even programming, dedication is a must-have trait. They need to be dedicated to their job, doing and doing the same thing countless time, refining they skills anytime to make them able to provide masterpieces.

Conclusion

There are essential attitudes, where the attitudes are useful in any line of job and the other attitudes are job-specifics. Knowing which attitudes to look for is as important as knowing that hiring for attitude is better than hiring for skills. When you are mistakenly looking for the wrong attitude required, you are hiring the bad employee.

Microsoft SQL Server : What you need to know as beginner developer?

I realized that Microsoft SQL server is easy to use and setup. It’s UI (management studio) is easy to use, user friendly and nice. However, used by beginner developer, usually the SQL Server will perform bad. As a beginner at MS SQL Server world, what do you need to know?

In this series, I will provides hints and small description about what topics you need to learn beforehand. If you need detailed explanation, you need to do detailed research yourself.

Database transaction isolation level and lock hints

This is the very first thing that you need to know when developing system with SQL Server as database. Why? Because not knowing this will grant you over 80% possibility of deadlock when used in high-transaction system.

By default, MS SQL Server use Serializable isolation level for read queries (select). It is the heaviest-locking isolation level that you can achieve with SQL Server. The most secure, but also the most problematic. It basically locks the table (or page) every time you do select/insert/update/delete queries. In heavy read and light write applications such as stackoverflow, this usually cause problems.

Microsoft recommend Read Committed Snapshot Isolation (RCSI) level for common system. But still you need to search for yourself the best isolation level that is most suit with your apps.

Auto-commit transaction

By default, MS SQL enables the auto commit feature, means that every insert/update/delete that is not inside a transaction will be wrapped in a transaction and committed. This is bad for performance, because every commit will add record into your database log and it hurts performance. This is especially happen in looped-generated statement (to insert/update/delete many rows from applications).

Basically to avoid this, you need to wrap your statements in a transactions, or set auto commit off.

Backup Recovery Model

By default, MS SQL has backup recovery model set to FULL. In contrast to SIMPLE recovery model, full recovery model enables you to point-in-time recovery per transaction committed. While in simple model it is not supported. In short, set to simple model if you don’t think that point-in-time recovery is required, especially in logging database.

Indexing

Indexing is complex, but in case you need to maintain database performance against big volume data, you need to learn indexing. First, you need to know how to get the query execution plan. Next, you need to know the index seek vs index scan, key lookup, and sargable query.

In short, what I recommend is:

* Always use primary keys in all your tables,

* If you need to do join query, ordered by recommendation, it’s better if you can:
1) join between primary key/foreign key
2) the joining field contains same data type and length
3) avoid computational at where clause or joining fields, eg: isnull, where fieldA < fieldB + 1
4) do not use leading wildcard (percent) in string search

Connection overhead

Opening connection and user authentication is providing some performance impact. It is not much, but exists, especially when the application server is far away from database server. Please note that stating there is connection overhead does not means that keeping the connection open is the solution. What you need to avoid is opening/closing connection inside an application loop. It’s better to re-factor it to become more like set-based operation.

Scalar vs table-valued function

In MS SQL, there are 3 types of functions, that is scalar function, table valued function and multi-statement table-valued function. Execution plan wise, scalar and multi-statement table valued is same, while table-valued function is operated more like accessing view. So let’s consider multi-statement table valued function the same as scalar in this topic.

Scalar function inside select column / join / where clause will be converted in looping operations. Meanwhile table-valued function will be treated the same as view, and then being included in query plan as set operations. So, in short, if the function you defined is accessing any table, avoid define it in scalar function.

Conclusion

SQL Server, after being installed can be easily used. But not knowing the features of SQL Server and then using it to make complex system can cause problems. Before actually using it in real system, I suggest that you at least know the points I described above.

However, even if I know those points, it does not immediately makes me know all the SQL Server and the best configurations for each scenarios. I am not a database administrator after all.