Skip to content

Tag: postgresql

Calculate share of value per day per country

DB-Fiddle Expected Result: I want to calculate the sales share per country per day as it is done in the question here. However, since I added the column channel in the database I am not getting the right shares anymore using this query: How do I need to modify this query to get the expected results? Answer he…

Creating primary key in postgresql takes days

I am trying to write my table to a PostgreSQL database then declare a primary key. My data is really huge (includes billions of rows and total size is approximately 150 GB), when I try to create a primary key after writing the table, it takes forever. Here is how I define the primary key; I am %101 sure about

Get rid of all empty strings values in jsonb | Postgres

I have rather abstract question on PostgreSQL jsonb data. For example I have a table called… table_one, where I have a column: In 100% cases in contains flat json structure like example: might be different length or null but always flat. My goal is like that. Whenever I select this column I need to somehow co…