Skip to main content


Showing posts from January, 2023

Achieving Seamless Navigation through AWS Cognito

Seamless Navigation with AWS Cognito Cognito is an identity and access management solution of the AWS ecosystem. It allows you to secure your applications and manage your users credentials and helps you control access management. Cognito provides capabilities to secure applications with SAML, OIDC and OAUTH2 protocols. You can find more information on Cognito on Amazon's web site here: . Especially checkout the developer documentation here: . Background There is a lot to cover in AWS Cognito. This article will be focusing on how to achieve seamless navigation between two different client applications. You can consider this scenario as a federated scenario suing SAML or OIDC federation. However, I wanted to cover a scenario where web profile isn't available in one of those applications so you don't have an IDP Session to help you login to your secondary

PostgreSQL: Partitioning/Sharding and Foreign Data Wrapper Step up and Configuration

Following snippet of PostgreSQL documentation, , explains the benefits of partitioning as fallows.  Partitioning refers to splitting what is logically one large table into smaller physical pieces. Partitioning can provide several benefits: Query performance can be improved dramatically in certain situations, particularly when most of the heavily accessed rows of the table are in a single partition or a small number of partitions. Partitioning effectively substitutes for the upper tree levels of indexes, making it more likely that the heavily-used parts of the indexes fit in memory. When queries or updates access a large percentage of a single partition, performance can be improved by using a sequential scan of that partition instead of using an index, which would require random-access reads scattered across the whole table. Bulk loads and deletes can be accomplished by adding or removing partitions, if

Useful PostgreSQL Queries

I have been actively using PostgreSQL for the last 7 years. As with many databases engines, PostgreSQL provides us with many capabilities when it comes to helping developers identify slow performing queries. This article focuses on several useful (primarily administrative queries) for PostgreSQL which may be helpful in debugging you database performance issues. Queries Show Running Queries Often times it is useful to see which queries are running and how long they have been running from. The below is a sample query to find 'active' queries and information about them.  SELECT pid, client_addr, query_start, age(query_start, clock_timestamp()), usename, query, state, wait_event_type, -- Only available in >9.6 wait_event -- Only available in >9.6 FROM pg_stat_activity WHERE query != ' ' AND query NOT ILIKE '%pg_stat_activity%' AND state = 'active' ORDER BY query_start desc; Particularly useful attribute

How to Use sqlite-utils to Create Tables from JSON Input

There are many way to query JSON data. This article focuses on one of those possible ways using few developer utility tools. : sqlite3: sqlite-utils: You can call an HTTP API as below. Use jq to transform the return content as you need. Then pipe it through sqlite-utils to perform upsert. Following code snippet simply creates a "test" table with primary key being the id attribute.  curl --location --request POST '' \ --header 'Authorization: Bearer XXXXXX' \ --header 'Content-Type: application/json' \ --data-raw '{"date":"2019-01-01T00:00:00.000Z"}' | jq '.content' | sqlite-utils upsert /tmp/test.db content - --pk=id Once this executes, you can then filter this and export easily using Sqlite3 as follows. >sqlite3