diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
 Changelog for tmp-postgres
 
+1.28.1.0
+  #208 Only hash important envs for initdb cache.
+
 1.28.0.0
   #200 Change behavior of Permanent. We now create the directory if it does not exist. Other changes
 
diff --git a/profiling/Main.hs b/profiling/Main.hs
new file mode 100644
--- /dev/null
+++ b/profiling/Main.hs
@@ -0,0 +1,12 @@
+import Database.Postgres.Temp
+import Control.Exception
+
+withLoop :: IO ()
+withLoop = either throwIO pure =<< with (const $ pure ())
+
+withCacheLoop :: IO ()
+withCacheLoop = withDbCache $ \cache -> either throwIO pure =<<
+  withConfig (defaultConfig <> cacheConfig cache) (const $ pure ())
+
+main :: IO ()
+main = withCacheLoop
diff --git a/src/Database/Postgres/Temp/Internal/Config.hs b/src/Database/Postgres/Temp/Internal/Config.hs
--- a/src/Database/Postgres/Temp/Internal/Config.hs
+++ b/src/Database/Postgres/Temp/Internal/Config.hs
@@ -395,9 +395,9 @@
   -- TODO come up with a better way to deal with this. Probably
   -- need to lock the directories recursively before deleting.
   handle ignoreDirIsMissing $
-    try (removePathForcibly mainDir) >>= \case
-    Left (_ :: IOError) -> try (removePathForcibly mainDir) >>= \case
-      Left (_ :: IOError) -> removePathForcibly mainDir
+    try (removeDirectoryRecursive mainDir) >>= \case
+    Left (_ :: IOError) -> try (removeDirectoryRecursive mainDir) >>= \case
+      Left (_ :: IOError) -> removeDirectoryRecursive mainDir
       Right _ -> pure ()
     Right _ -> pure ()
 
@@ -606,7 +606,8 @@
 
 makeCommandLine :: String -> CompleteProcessConfig -> String
 makeCommandLine command CompleteProcessConfig {..} =
-  let envs = unwords $ map (\(x, y) -> x <> "=" <> y) completeProcessConfigEnvVars
+  let envs = unwords $ map (\(x, y) -> x <> "=" <> y)
+             $ filter ((`elem` envsToKeep) . fst) completeProcessConfigEnvVars
       args = unwords completeProcessConfigCmdLine
   in envs <> " " <> command <> args
 
@@ -622,6 +623,39 @@
     version = getInitDbVersion
     theHash = makeArgumentHash cmdLine
   in cacheFolder <> "/" <> version <> "/" <> theHash
+
+envsToKeep :: [String]
+envsToKeep =
+  [ "PGHOST"
+  , "PGHOSTADDR"
+  , "PGPORT"
+  , "PGDATABASE"
+  , "PGUSER"
+  , "PGPASSWORD"
+  , "PGPASSFILE"
+  , "PGSERVICE"
+  , "PGSERVICEFILE"
+  , "PGOPTIONS"
+  , "PGAPPNAME"
+  , "PGSSLMODE"
+  , "PGREQUIRESSL"
+  , "PGSSLCOMPRESSION"
+  , "PGSSLCERT"
+  , "PGSSLKEY"
+  , "PGSSLROOTCERT"
+  , "PGSSLCRL"
+  , "PGREQUIREPEER"
+  , "PGKRBSRVNAME"
+  , "PGGSSLIB"
+  , "PGCONNECT_TIMEOUT"
+  , "PGCLIENTENCODING"
+  , "PGTARGETSESSIONATTRS"
+  , "PGDATESTYLE"
+  , "PGTZ"
+  , "PGGEQO"
+  , "PGSYSCONFDIR"
+  , "PGLOCALEDIR"
+  ]
 
 splitDataDirectory :: CompleteProcessConfig -> (Maybe String, CompleteProcessConfig)
 splitDataDirectory old =
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -472,10 +472,8 @@
 
       withConfig nonEmptyFolderPlan mempty >>= \case
         Right () -> fail "Should not succeed"
-        Left ((InitDbFailed theOut theErr code)) -> do
+        Left ((InitDbFailed _ _ code)) ->
           code `shouldBe` ExitFailure 1
-          length theOut `shouldSatisfy` (> 0)
-          length theErr `shouldSatisfy` (> 0)
         Left err -> fail $ "Wrong type of error " <> show err
 
   it "invalid initdb options cause an error" $ do
diff --git a/tmp-postgres.cabal b/tmp-postgres.cabal
--- a/tmp-postgres.cabal
+++ b/tmp-postgres.cabal
@@ -1,5 +1,5 @@
 name:                tmp-postgres
-version:             1.28.0.0
+version:             1.28.1.0
 synopsis: Start and stop a temporary postgres
 description: Start and stop a temporary postgres. See README.md
 homepage:            https://github.com/jfischoff/tmp-postgres#readme
@@ -99,7 +99,7 @@
   main-is: Main.hs
   hs-source-dirs: benchmark
   default-language: Haskell2010
-  ghc-options: -O2 -Wall
+  ghc-options: -O2 -Wall -threaded -rtsopts -with-rtsopts=-N
   build-depends: base
     , criterion
     , deepseq
@@ -155,6 +155,31 @@
     , TupleSections
     , ViewPatterns
 
-source-repository head
-  type:     git
-  location: https://github.com/jfischoff/tmp-postgres
+executable with-cache-loop
+  main-is: Main.hs
+  hs-source-dirs: profiling
+  default-language: Haskell2010
+  ghc-options: -O2 -Wall -threaded -rtsopts -with-rtsopts=-N
+  build-depends: base
+    , async
+    , directory
+    , postgres-options
+    , postgresql-simple
+    , process
+    , temporary
+    , tmp-postgres
+  default-extensions:
+      ApplicativeDo
+    , DeriveFunctor
+    , DeriveGeneric
+    , DerivingStrategies
+    , DerivingVia
+    , GeneralizedNewtypeDeriving
+    , LambdaCase
+    , OverloadedStrings
+    , RankNTypes
+    , RecordWildCards
+    , ScopedTypeVariables
+    , TemplateHaskell
+    , TupleSections
+    , ViewPatterns
