Skip to content

Commit f6e8094

Browse files
committed
Simplify selection of without rowid tables
1 parent 10a6439 commit f6e8094

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/include/souffle/io/WriteStreamSQLite.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,11 @@ class WriteStreamSQLite : public WriteStream {
199199
void createRelationTable() {
200200
std::stringstream createTableText;
201201
createTableText << "CREATE TABLE IF NOT EXISTS '_" << relationName << "' (";
202-
// 8 bytes per datum worst case + 1 byte per datum in header + 1 byte header length < ~1/20 DB page
202+
// 8 bytes per datum worst case + 1 byte per datum in header + 1 byte header length < ~1/20 DB page (4096 bytes)
203203
// size See https://sqlite.org/withoutrowid.html#when_to_use_without_rowid and
204204
// https://sqlite.org/fileformat2.html#record_format for justification
205-
bool shouldUseWithoutRowid = (arity * 9 + 1) < 200;
205+
// 22*9+1 = 199 < 200
206+
bool shouldUseWithoutRowid = (arity>0 && arity<23);
206207
if (arity > 0) {
207208
createTableText << "'0' INTEGER";
208209
for (unsigned int i = 1; i < arity; i++) {

0 commit comments

Comments
 (0)