Understanding SQLite’s PI() Function

The PI() function in SQLite returns the mathematical constant π (pi), which is approximately 3.14159265358979. It is used to represent the ratio of the circumference of a circle to its diameter.

The PI() function is commonly employed in mathematical computations, particularly in geometry, trigonometry, and other scientific calculations involving circles and angles.

Continue reading

Understanding Serverless Databases: Classic Serverless vs Neo-Serverless

The term “serverless database” has gained popularity with the rise of cloud computing and on-demand services, but it has a dual meaning depending on context.

In particular, databases can be “serverless” in either the traditional, client-side manner (e.g., SQLite’s model) or the cloud-native way often associated with managed databases.

This article explores these two approaches to serverless databases—classic serverless and neo-serverless—along with contrasting examples from other database models like client/server architectures.

Continue reading

Understanding the ATAN2() Function in SQLite

The ATAN2() function in SQLite calculates the arc tangent (inverse tangent) of the ratio of two given numeric values, typically representing the y-coordinate and x-coordinate of a point.

Unlike ATAN(), which calculates the angle based only on a single tangent value, ATAN2() considers both the x and y values to determine the correct quadrant for the resulting angle.

Continue reading

List All Prepared Statements in a PostgreSQL Session

Prepared statements are a precompiled SQL queries that we can execute multiple times with different arguments. They are limited to the current session, so we can only create them and run them from within the same session.

Sometimes we might want to review how many prepared statements we’ve created. Or we might need to deallocate one, but we’ve forgotten its name.

No problem. We can use the pg_prepared_statements view to see all of our prepared statements.

Continue reading