             XCTAssertEqual(label, "Toreador.snapshot.2")
         }
     }
+    
+    // MARK: - Checkpoints
+    
+    func testAutomaticCheckpointDoesNotInvalidateSnapshot() throws {
+        let dbPool = try makeDatabasePool()
+        let counter = try Counter(dbPool: dbPool)
+        try dbPool.write(counter.increment)
+        let snapshot = try dbPool.makeSnapshot()
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+        try dbPool.writeWithoutTransaction { db in
+            // 1000 is enough to trigger automatic snapshot
+            for _ in 0..<1000 {
+                try counter.increment(db)
+            }
+        }
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+    }
+    
+    func testPassiveCheckpointDoesNotInvalidateSnapshot() throws {
+        let dbPool = try makeDatabasePool()
+        let counter = try Counter(dbPool: dbPool)
+        try dbPool.write(counter.increment)
+        let snapshot = try dbPool.makeSnapshot()
+        try? dbPool.checkpoint(.passive) // ignore if error or not, that's not the point
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+        try dbPool.write(counter.increment)
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+    }
+    
+    func testFullCheckpointDoesNotInvalidateSnapshot() throws {
+        let dbPool = try makeDatabasePool()
+        let counter = try Counter(dbPool: dbPool)
+        try dbPool.write(counter.increment)
+        let snapshot = try dbPool.makeSnapshot()
+        try? dbPool.checkpoint(.full) // ignore if error or not, that's not the point
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+        try dbPool.write(counter.increment)
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+    }
+    
+    func testRestartCheckpointDoesNotInvalidateSnapshot() throws {
+        let dbPool = try makeDatabasePool()
+        let counter = try Counter(dbPool: dbPool)
+        try dbPool.write(counter.increment)
+        let snapshot = try dbPool.makeSnapshot()
+        try? dbPool.checkpoint(.restart) // ignore if error or not, that's not the point
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+        try dbPool.write(counter.increment)
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+    }
+    
+    func testTruncateCheckpointDoesNotInvalidateSnapshot() throws {
+        let dbPool = try makeDatabasePool()
+        let counter = try Counter(dbPool: dbPool)
+        try dbPool.write(counter.increment)
+        let snapshot = try dbPool.makeSnapshot()
+        try? dbPool.checkpoint(.truncate) // ignore if error or not, that's not the point
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+        try dbPool.write(counter.increment)
+        try XCTAssertEqual(snapshot.read(counter.value), 1)
+    }
+    
+    // MARK: - Schema Cache
+    
+    func testSnapshotSchemaCache() throws {
+        let dbPool = try makeDatabasePool()
+        try dbPool.write { db in
+            try db.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY)")
+        }
+        let snapshot = try dbPool.makeSnapshot()
+        try snapshot.read { db in
+            // Schema cache is updated
+            XCTAssertNil(db.schemaCache.primaryKey("t"))
+            _ = try db.primaryKey("t")
+            XCTAssertNotNil(db.schemaCache.primaryKey("t"))
+        }
+        snapshot.read { db in
+            // Schema cache is not cleared between reads
+            XCTAssertNotNil(db.schemaCache.primaryKey("t"))
+        }
+    }
 }

        }
    }
    
    func testDefaultLabel() throws {
        let dbPool = try makeDatabasePool()
        

            try XCTAssertEqual(String.fetchOne(db, sql: "SELECT foo()")!, "foo")
        }
    }
    
    // MARK: - Collations
    
    func testSnapshotInheritPoolCollations() throws {
        let dbPool = try makeDatabasePool()
        let collation = DatabaseCollation("reverse") { (string1, string2) in
