Many Ways to Optimize an OLTP Database Running PostgreSQL

Updated on 2/1/22
Tuning relational databases and related processes can be somewhat simple or very complex. OLTP databases have many processes governing the usage of resources. Optimizing these and keeping locks granular and efficient in accord with business requirements is key to having high performance and reliability.

Studying the business requirements carefully can allow you to redesign the database and the SQL queries to make things happen more efficiently.

When Performing Equivalence Operations on Each Item in a List or in a Tuple, which Process Takes Less Time in Python?

Problem scenario
You are trying to refactor Python code. There is an equivalence operation that happens ten million times. You are concerned that a tuple may be a better data structure than a list. Which would operate more quickly and how do you find out for sure?

Solution
The tuple will be faster.

Operations in a tuple are slightly faster.

How Should You Automate Linux Tasks with Python 2 vs Python 3?

Problem scenario
You have been given a task to automate tasks in Python. You were advised to never use “import os” in a previous position. You were told that this time speed is very important. What should you do?

Possible Solution #1
If you are doing basic file manipulations such as copying or moving files, or changing files’ permissions, you may want to looking into “import shutil”.

In Python, What Are Some Advantages with Calling a Function or as a New Thread?

Question
Python supports the creation of new threads for [bound or unbound] functions. They can help with multiprocessing. New threads are ideal for non-blocking operations like serving a GUI. If you want a server to begin certain operations in parallel with others, you may want to use new threads as opposed to new processes (which can provide the same parallel processing benefit).

In Python, What Are Some Disadvantages with Calling a Function as a New Thread?

Question
Python supports the creation of new threads for [bound or unbound] functions. They can help with multiprocessing. If you want a server to begin certain operations in parallel with others, you may want to use new processes as opposed to new threads. Both threads and processes can provide the same parallel processing benefit. What are some disadvantages of using a thread to call a function?

What is DevOps and Why Do People Want to Adopt It?

What is DevOps?
DevOps, among other things, is a business cultural shift that affects how labor is divided at different companies that adopt it. At the enterprise level, a company that embraces DevOps culture may have teams of employees focused on builds and releases or automation. These teams may be integrated with software engineers, systems administrators, quality assurance analysts, database administrators and security experts. A reduction itself in departments within I.T.

How Do You Optimize Data Warehouse Performance?

Problem scenario
You have a data warehouse that has not been performing as well as you would like.  What are some things that you can do to optimize the performance?

Solution
1.  Schedule processes such as back ups or ETL jobs at different times from hours of peak demand.  Rebuilding indexes can be a good idea or a bad one depending on when it is performed. 

What Can Be Done to Enhance the Reliability and Performance of a Jira Server?

Problem scenario
You find that your Jira is very slow and sometimes stalls or hangs when it is being used.  The Linux back-end of the Jira server shows considerable CPU and memory constraints.  When Jira is up on the back end you use the Linux “top” command, you find that the CPU and RAM are being heavily utilized.  You want to optimize the system for improved performance. 

How Do You Troubleshoot a Network Problem?

Note:  This posting should help you troubleshoot many different network problems (not just those described in the problem scenario below).  Possible solutions 1 through 5 are ideal for erratic nmap results (inconsistent or discrepant output). 

Problem scenario
A port seems blocked on a Linux server given the results of nmap. The host appears to be down. You know this port is not blocked by intermediate routers and/or firewalls.