Posts

Showing posts from August, 2025

CRUD database operations

CRUD is an abbreviation used to remember database operations. CRUD stands for create, read, update and delete.

Reddit wants to become a search engine

Reddit wants to become a search engine. News article

Loops

Loops help perform repetitive activities many times. Loop will repeat so many times as condition for the loop is false. Common loops are “for” loop, while loop and repeat until loop. For loop specifies condition for the loop and alternatively a step for each iteration of loop cycle. By default this step is equal to one and it can be omitted. There two more types of loops. These are repeat until loop and while loop. Repeat until loop will check the condition before the loop cycle and while loop will check the condition at the end of the loop cycle. It is important to modify variable that is used if that loop condition, otherwise it is possible to end up with indefinite loop. Indefinite loop may also happen with a for loop. By default a variable that is used for loop condition will be changed. If that variable value is reverted back or changed inside of that loop than it is possible to have indefinite loop. You are probably familiar with hour glass mouse cursor in Windows or beach ball i...

Caching of data

Caching of data can be used to speed up access to data, instead of getting data from database tables data will be coming from cache. Data stored in cache is often stored in memory this speeds up retrieval operations. If underlying data had been changed then cache records need to be invalidated, otherwise incorrect data will be retrieved. Cache can internal or external. Internal cache is often has limited amount of memory allocated to it. External cache can be much larger in size. Redis is an example of external cache that can be used.

Non-relational databases

Other paradigm of storing data in a database is to use NoSQL database. NoSQL tables are much simpler than SQL tables and faster too, because validation of records is not done by the database but by front-end. The code needs to ensure that record that is being inserted has proper relationships. NoSQL databases are much simpler than SQL databases. If SQL databases require vertical scaling in order to handle additional load, then NoSQL databases can be scaled horizontally by adding more systems. These systems can perform differently, please be aware that slower machines will be performing slower than fast machines. Example of NoSQL databases are: MongoDB, CouchDB.

Relational databases

Relational databases establish relationships between data. For example relational database may have customer table and customer orders table. Customer orders table will be pointing back to the customer table to ensure that record there has corresponding record in customer table. To validate this relationship processing resources must be used, because of it inserting data into database will be slower than NoSQL databases. I will explain NoSQL database next. If there is no corresponding record then insert operation will fail. In order to handle an increased traffic, database server needs to be made performing better. This is often called “scaling up” or “vertical scaling”. Getting a faster computer is often expensive and company needs to migrate data from an existing computer to a better one which is a difficult and task that is very sensitive. If something goes bad, then downtime of systems may be expected. Examples of relational databases are: MySQL, Oracle, DB2, Microsoft SQL.