- Create
UNLOGGED
table. This reduces the amount of data written to persistent storage by up to 2x. - Set
WITH (autovacuum_enabled=false)
on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we neverDELETE
orUPDATE
the table). - Insert rows with
COPY FROM STDIN
. This is the fastest possible approach to insert rows into table. - Minimize the number of indexes in the table, since they slow down inserts. Usually an index
on
time timestamp with time zone
is enough. - Add
synchronous_commit = off
topostgresql.conf
. - Use table inheritance for fast removal of old data:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// | |
// If you want to use the record and DU types, the whole type becomes | |
// private, which means that you also need to provide: | |
// * a constructor function ("create"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Yaml configuration section | |
<?xml version="1.0" encoding="utf-8"?> | |
<akka.persistence> | |
<hocon> | |
<![CDATA[ | |
akka { | |
persistence{ | |
query.journal.sql { | |
max-buffer-size = 10000 |
This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.
- Download WSL2 Kernel
- run
wsl --set-default-version 2
in windows command line, so that all future WSL machine will use WSL2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ChrisPenner where | |
import Data.Array ((!)) | |
import Data.Foldable (for_, foldl', maximumBy) | |
import Data.List (sort) | |
import Data.Map.Strict (Map) | |
import Data.Ord (comparing) | |
import qualified Data.Array as A | |
import qualified Data.Map.Strict as Map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//open System.IO | |
//Directory.GetFiles(@"C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\5.0.11", "*.dll") | |
//|> Array.map (fun f -> $"""#r "{Path.GetFileName(f)}" """) | |
//|> Array.iter (printfn "%s") | |
#I @"C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\5.0.11" | |
#r "Microsoft.AspNetCore.Antiforgery.dll" | |
#r "Microsoft.AspNetCore.Authentication.Abstractions.dll" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Explanation | |
(* | |
So what is going on in module `ValidatedSum`? This is a more detailed explanation and a piece of guidance. The goal of | |
all of this is being able to define libraries with "safe" APIs. To be more precise, "safe" means that functions with | |
interesting preconditions can only be used (applied) such that the precondition is guaranteed to hold; it is impossible | |
to apply a function on inputs for which the precondition does not hold. | |
A well-known example is `List.head`. The precondition of applying this function to list `l` is that `l` is non-empty. If |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Non-empty trees. | |
type Tree<'a> = TreeNode of 'a * List<Tree<'a>> | |
/// Syntactic simulation of the `Tree` base functor. | |
let (|TreeNode_|) (a, ys) = (a, ys) | |
/// Regular catamorphism for `Tree`. | |
let rec cata f (TreeNode (a, ts)) = f a (ts |> List.map (cata f)) | |
/// Compute a result from a single `Tree` node while having access to a function which computes a result from a single |
OlderNewer