Product:
DuckDB v1.5.5 (Variegata)

Issue:

How sum a big csv file?  Excel is to small.

Solution:

Download DUCKDB, that is an embedded column-oriented database purpose-built for analytical workloads (OLAP).
DuckDB load your data in memory on your laptop, and then let you use SQL querys to find out information.
DuckDB’s SQL parser is derived from the pg_query library (https://www.sqlite.org/cli.html) , which is itself derived from PostgreSQL’s SQL parser that has been stripped down as much as possible.

On windows download the duckdb zip file, and unzip it to a folder like c:\duckdb. Go to that folder with powershell and enter DUCKDB to start the program.  https://duckdb.org/install/?platform=windows&environment=cli

 .\duckdb.exe

To import a csv file, that use European characters (note it use Linux syntax, forward slash for folders) , use a command like this:

create table budget as select * from read_csv_auto('c:/temp/db/datatabell.csv' , encoding='Latin-1') ;

This will create a in-memory databas called budget, that you can query, like to list number of rows:

select count(*) from budget ;

To get a sum for a month (note that it differs for small and capital letters  Month and month are two different columns):

select sum(amount) from budget where Månad='01' and År=2027;

Enter below to get a quick glance of what column names exist in the database table:

select * from budget ;

Then you can see the name and if it is int64 or varchar.   To find rows with zero as value, enter:

select * from budget where amount = 0;

 

To stop duckdb enter  .exit.  When you  exit duckdb the database is erased.

 

More Information:

DuckDB’s architecture delivers several distinct advantages over traditional databases and data analysis tools:

  • Vectorized query execution — Processes data in batches of 2048 rows, maximizing CPU cache efficiency and enabling SIMD acceleration
  • Columnar storage — Only reads the columns your query requests, dramatically reducing I/O compared to row-based systems
  • Direct file querying — Query CSV, Parquet, and JSON files directly without importing them first — a massive productivity boost
  • Hybrid execution — Supports both in-memory and on-disk processing, automatically spilling to disk when datasets exceed available RAM
  • Full SQL standard compliance — Supports complex queries including window functions, CTEs, PIVOT, and UNION that go far beyond what Excel or Pandas can do
  • Multi-language support — First-class bindings for Python, R, Java, Node.js, C++, Rust, and many more
  • Extension ecosystem — Load extensions for HTTP/S3 access, full-text search, spatial data, and more

How DuckDB Compares to Alternatives

Aspect DuckDB SQLite Pandas PostgreSQL
Storage model Columnar Row-based In-memory Row-based
Analytics perf ⚡ Fast Slow Fast (fits RAM) Moderate
Setup time Seconds Seconds Minutes (env) Hours (server)
Max dataset >RAM (spills) <RAM <RAM >RAM
SQL features Full Basic No native SQL Full

 

https://duckdblab.org/en/post/duckdb-beginners-guide-2026/ 

https://duckdb.org/docs/lts/data/csv/overview

https://duckdb.org/docs/current/guides/file_formats/csv_import

https://duckdb.org/docs/current/sql/introduction

https://motherduck.com/blog/duckdb-tutorial-for-beginners/

https://www.sqlite.org/cli.html

https://en.wikipedia.org/wiki/DuckDB

https://github.com/davidgasquez/awesome-duckdb 

https://duckdblab.org/en/cheatsheet/

https://duckdb.org/docs/current/sql/dialect/friendly_sql

Query Features

Product:

Microsoft Azure SQL

Issue:

Store procedures / process take a long time to finish – than a few weeks ago to a lot less of time.
The usage of resources in the SQL server is flat in the monitor view.

Solution:

Check that you do not have any columns that use [NVARCHAR](MAX) in a stage table or other table. This can when data grow in your tables, make the SQL CPU /Memory resources – be to small for it to handle.

Check also if you can make a CREATE NONCLUSTERED INDEX on you largest table that are in use in the query, to help improve performance.

As a very short term solution, you can increase cpu and memory on your Azure SQL instance, but this is not a good solution.

When you combine an nvarchar(max) with an nvarchar(100), SQL Server often implicitly promotes the result to nvarchar(max). Once an expression becomes a LOB (Large Object) type, SQL Server may switch to much more expensive processing. Nvarchar(max) is treated differently than normal string types. nvarchar(100) is stored directly in-row.
nvarchar(max) may be stored off-row. “Stored off-row” means SQL Server may not keep the actual string data inside the data page that contains the rest of the row. A SQL Server data page is only 8 KB. Then SQL Server must maintain LOB pointers and perform additional I/O.

This increases CPU and memory usage. When SQL Server sees nvarchar(max), it must assume values could be huge (up to 2 GB).

Check whether SQL Server is using off-row storage

SELECT
OBJECT_NAME(object_id),
lob_used_page_count,
used_page_count
FROM sys.dm_db_partition_stats
WHERE object_id = OBJECT_ID('dbo.Test');

 

If lob_used_page_count is non-zero, SQL Server is storing LOB (nvarchar(max), varchar(max), xml, etc.) data on separate pages.

 

To see what SQL are doing, enter:

sp_who2

More Information:

https://www.brentozar.com/archive/2016/10/max-data-types/

https://www.brentozar.com/archive/2025/10/which-should-you-use-varchar-or-nvarchar/

https://www.brentozar.com/free-sql-server-training-videos/ 

https://vladdba.com/2024/05/26/the-curious-case-of-the-truncating-nvarcharmax-variable/

https://www.conradakunga.com/blog/how-to-index-a-nvarcharmax-table-in-sql-server/ 

https://learn.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql?view=sql-server-ver17 

https://erikdarling.com/using-sp_tableoption-to-store-lob-data-off-row/ 

https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/performance/troubleshoot-memory-issues