Import
One command turns a SQLite file or a PostgreSQL table into a fennecdb collection, its fields typed and its indexes built, and can keep it following the table's changes.
Import a table
Name the source, the table and the collection to make. The schema is worked out from the table's columns, and each index you name is built once the rows are in.
fennec import data.sqlite --table docs --into articles --index "category@hash"
fennec import postgres://user@host:5432/database --table docs \
--into articles --index "category@hash"$ fennec import data.sqlite --table docs --into articles --index "category@hash"
source data.sqlite -> docs
target articles.fennec -> articles
3 records, articles.fennec (12.82ms)
index category @hashWhat the import derives and writes
The import derives the schema, the table's integer key becoming each
document's id, writes the rows in batches and builds the indexes after the
last, rather than keep them up a row at a time. The collection goes into
<into>.fennec unless --file names another, held
while the import runs as the shell holds a file: one a server has open is
refused, since two processes writing one file corrupt it. What a crash left
beside the file it removes as the shell does (the shell), a beside line each
among its own. A
column of embeddings comes across too (Vector
columns). Every option is in fennec import --help.
Look before you write
--dry-run prints the schema it would make, and any warnings,
and writes nothing.
$ fennec import data.sqlite --table docs --into articles --index "category@hash" --dry-run
source data.sqlite -> docs
target articles.fennec -> articles
create collection articles (
title text <- text
category text <- text
score int <- int
published timestamp <- datetime
)
id <- id (INTEGER PRIMARY KEY)
create index on articles (category) @hash
nothing was written (--dry-run); use --count for the row count--countalso prints how many rows will be read.
Why --count is a separate flag
--count is a separate flag because counting means a full scan:
SQLite keeps the row count nowhere and count(*) in PostgreSQL
reads the table from the start. Silently reading everything twice would be a
bad default.
Sources
A SQLite file is read directly, and a PostgreSQL server is read over the network. Nothing else needs to be installed for either.
- SQLite: no
sqlite3library or binary needed. - PostgreSQL: no
psqlorpg_dumpneeded; pgvector's columns are recognised.
How each source is read
SQLite. The file format is read directly — neither the
sqlite3 library nor the binary is needed. INTEGER PRIMARY
KEY becomes the document id, --vector field:N turns
little-endian f32 BLOBs into vector<N>, and
untyped columns are resolved from the first 1000 rows.
Each column is read where SQLite puts it in a row. A VIRTUAL
generated column (b AS (a * 2)), which SQLite computes as a row
is read and never stores, is left out, and the import names it in a
warning line; a STORED one comes across as a plain
field holding the values SQLite stored. The import computes no expression. A
column named "" keeps its place as column<N>,
N its place from 1, as SQLite names a result column that has no name. A row
written before an ALTER TABLE ... ADD COLUMN reads the column
as its default, as SQLite reads it there, and NULL where it has
none: numbers, strings, blobs, TRUE, signs before them,
CAST and hexadecimal numbers past 32 bits, each with the
column's type applied as SQLite applies it. A default the import cannot read
as SQLite does stops it at a row that needs it, naming the table, the column
and the default: CURRENT_TIMESTAMP or an expression, which no
row SQLite wrote needs, and the rare constant SQLite reads by its own
formatting of a real as text, by a text's leading digits
(-'5 apples'), or by taking a blob's bytes as text or a text's
as a blob. A WITHOUT ROWID table is refused by name; a
STRICT one is read, and a table of more columns than SQLite
allows, 32 767, is refused by name, as is one of more than 4 096, the
places a collection holds, by the collection it
would make.
The file is read alone, so the import looks beside it for the two files
SQLite keeps there, and refuses the file while either holds what the file
does not: a <file>-wal with changes not yet checkpointed
(sqlite3 data.sqlite "PRAGMA wal_checkpoint(TRUNCATE)" moves
them in), or a hot <file>-journal, left by a writer
stopped in the middle of a transaction, beside a file that may be torn (one
read with SQLite rolls it back: sqlite3 data.sqlite "PRAGMA
user_version"). An empty -wal, and a journal whose header
is zeroed as journal_mode=PERSIST leaves it, are not in the
way. When the file is a symbolic link, they are looked for beside the file it
leads to, where SQLite keeps them on Linux and macOS; one that is not a plain
file — a FIFO, a device, a directory — is refused rather than opened.
A damaged or hostile file is refused naming the page — a page reached
twice, cells that overlap, an overflow chain longer than its row. Reading
the file holds a page and a row in memory at a time, whatever lengths it
declares: a row is a value for each of its table's columns, 32 767 at most,
which may read far larger than it is stored — a column it lacks reads as its
default — so a batch is written once its rows hold 16 MiB, before
--batch rows where rows are large. A row is at most about twice
the file's length as it is read (its stored bytes, no longer than the file,
and its values: its texts and blobs, and its defaults, no longer than the
CREATE TABLE text), more where a text is not UTF-8, each such
byte read as the three of U+FFFD. What an import holds at once is at most about
five times 16 MiB and its largest row together: a batch, the row that
filled it, and what the database makes of them while writing them.
What an import writes, and the time it takes, is the rows times what each
holds as SQLite reads it, a column it lacks its default, as SQLite returns
it to every query: a file of about 2 MB whose table gained a column with a
default of 1 MiB after its 150 000 rows of one byte were written imports
150 000 copies of the default, some 157 GB. That is the table SQLite
holds, and the file's length does not bound it: --limit takes
fewer rows.
PostgreSQL. It connects to the live server and streams
COPY ... TO STDOUT — no psql, no
pg_dump. Authentication is SCRAM-SHA-256, hand-written in
fennec-wire's client over fennec-http's own crypto
and held to RFC 7677's example exchange byte for byte (see
Signing in). TLS is
rustls's, with ring,
behind fennec-tls, the one shipped crate that takes
dependencies. pgvector's
vector, halfvec and sparsevec columns
are recognised along with their dimensions.
TLS
The connection string's sslmode says whether the connection
is encrypted and what of the server's certificate is checked, as libpq's
does, and sslrootcert names a PEM file of the CAs to check it
against:
<code>fennec import 'postgres://[email protected]/shop?sslmode=verify-full' --table products --file shop.fennec
fennec import 'postgres://[email protected]/shop?sslmode=verify-ca&sslrootcert=/etc/pg/ca.pem' --table products --file shop.fennec</code>sslmode | Encrypted | What is checked |
|---|---|---|
disable | no | — |
prefer, the default on this machine | where the server takes TLS | nothing |
require | yes, or no connection | nothing; with a CA file (sslrootcert, or ~/.postgresql/root.crt where it is), as verify-ca |
verify-ca | yes | the certificate is signed by the CA file's CAs; the name is not checked |
verify-full, the default for any other host | yes | the certificate is signed by a trusted CA and names the host dialed |
A host off this machine is spoken to under
verify-full unless the string says otherwise. The default
is prefer only for localhost and a loopback
address, where no one stands on the path. libpq's default is
prefer everywhere; this one differs on purpose (a deliberate
change since v0.2.0, whose default was prefer everywhere): a
connection string copied from a PostgreSQL client and pointed across a
network is checked rather than spoken to whoever answers. A
sslmode the string or PGSSLMODE names always
wins. Where the default refuses — a server that does not take TLS, or a certificate a
CA this client does not trust signed — the error names the cause, the CAs
it trusts, and the way out: sslrootcert=<file> with the CA
that signed it, or sslmode=require (TLS that checks nothing) or
sslmode=disable on a network you own. The mode taken and why
are printed (fennec import's tls line) or logged
(fennec-server --follow, once at the start).
prefer and require encrypt without checking
the server, as libpq's do not check it — require unless a CA
file is there, when it checks the chain as verify-ca. They keep
the rows from someone listening on the path, not from someone standing in
for the server, who would read them; and prefer goes on in
plain text where the server, or whoever stands in for it, refuses TLS. Only
verify-full keeps that out. Over a connection no CA checked,
the server's own words in an error are not shown — anyone on the path could
have written them — only its SQLSTATE code and this client's words for it;
on this machine, under verify-ca or verify-full,
or after a sign-in bound to the TLS session, they are shown, their control
characters escaped and cut at 512 bytes.
Without sslrootcert, libpq's own CA file,
~/.postgresql/root.crt (%APPDATA%\postgresql\root.crt
on Windows), is read where it is there, by require,
verify-ca and verify-full, as libpq reads it. With
neither, verify-full trusts the public CAs of Mozilla's store,
compiled into the binary, so a static binary in an empty container needs no
file of the system's (libpq would refuse). A server
whose certificate a private CA signed — Amazon RDS, Azure, Cloud SQL —
needs that CA's file in sslrootcert. sslrootcert=system
is the public store, taken only by verify-full, and
verify-ca takes a file: with every public CA trusted and no
name checked, any certificate a public CA signed would pass.
PGSSLMODE and PGSSLROOTCERT are read where the
string names neither. allow, client certificates
(sslcert, sslkey) and every other parameter are
refused rather than passed over.
The same string goes to fennec import, its
--follow and fennec-server --follow. A build
without the tls feature (--no-default-features)
speaks plain text under prefer, as libpq built without SSL
does, and refuses the modes that ask for TLS — the default for a host off
this machine among them, saying so.
Signing in
Holding a password, the client signs in by SCRAM-SHA-256 alone,
as libpq does with require_auth=scram-sha-256: a server — or
whoever stands in for it — that asks for the password in clear text or as
MD5, or that says the client is in before SCRAM's exchange is done, is
refused before anything of the password goes out. Before, the password was
sent in clear text to whoever asked, under prefer to anyone on
the path. A connection string takes libpq's require_auth to say
otherwise: require_auth=password sends it in clear text (over
verify-full only, sensibly), require_auth=scram-sha-256,none
also takes a server that asks for nothing, and each method may be negated
(!md5). MD5 is never spoken, allowed or not. With no password,
a server that asks for none is taken.
Over TLS, the sign-in is bound to the session
(SCRAM-SHA-256-PLUS, RFC 5929's
tls-server-end-point) wherever the server offers it, as
PostgreSQL 11 and later do over TLS: the proof carries the hash of the
certificate the client was shown, which the server compares with its own,
so a bound sign-in relayed through someone else's TLS session fails at
the server. What that keeps out depends on the mode. Under
verify-full, the default off this machine, no one else's
session gets that far: its certificate is refused. Under
require or prefer, which check nothing,
whoever is on the path can show its own certificate, take the
-PLUS offer out of what the server says and relay the sign-in
to the server in plain text: the client, offered nothing to bind, signs in
unbound, and a server reached in plain text takes that — PostgreSQL
refuses it only over TLS — so the relay is signed in and reads and writes
as the client. Under require it fails only where the server
takes TLS alone (hostssl lines in pg_hba.conf,
no host line for the role) or where the string says
channel_binding=require. channel_binding is
libpq's: prefer, the default, binds where it can;
require refuses a server that does not offer it, and a
connection in plain text; disable binds nothing.
What a server's SCRAM may ask is bounded. Its iteration count is
held to 4 096 (RFC 7677's floor; PostgreSQL's default) up to 4 194 304, 1 024
times the default and room above a hardened setting near a million —
seconds of a core. Below the floor a proof costs a guesser almost nothing,
above the cap the most a count can ask, four billion rounds, would hold the
import well over half an hour before it signed in: either is refused by
name, before a proof goes out. To come within it, set the role's password
again under another scram_iterations
(SET scram_iterations = 4096; then \password in
psql). A server nonce that is not the client's followed by the
server's own, and an m= extension, are refused, as RFC 5802
says. A password that is not ASCII is sent as its UTF-8 bytes, which is
what libpq sends where its SASLprep refuses a password and what a server
stores for one SASLprep leaves as it is — a password in NFKC, as one
typed on a keyboard nearly always is.
A sign-in is held to connect_timeout, libpq's
parameter in seconds (30 by default, 2 at least): the name's lookup, the
dial, the TLS handshake and every message up to the server's first
ReadyForQuery, however little at a time the server answers.
connect_timeout=0, libpq's "wait for ever", is refused.
Give the password in PGPASSWORD, not in the
connection string: a string given as an argument is in the process list,
which any user of the machine can read, and in your shell's history.
PGPASSWORD is read where the string names no password. A
% in the string not followed by two hex digits, and an
unknown parameter — a ? left unescaped in a password begins
one — are refused without the text being shown.
Type mapping
Each source type becomes the nearest fennecdb type. Types with no exact
match are refused until you say what to do with --cast.
| Source | fennecdb |
|---|---|
integer bigint int2/4/8 | int |
real double float4/8 | float |
text varchar char clob | text |
blob bytea | bytes |
boolean | bool |
date datetime timestamp(tz) | timestamp |
int[] float[] text[] | [int] [float] [text] |
vector(N) halfvec(N) | vector<N> vector<N, f16> |
sparsevec(N) | sparse<N>, read in the same text form |
geometry(Point, 4326) geography(Point) point | geo, [lon, lat]; another SRID or shape refused (Points) |
uuid | text |
citext, a SQLite column COLLATE NOCASE | text nocase, compared by its case fold (Case-insensitive text) — every script's, where SQLite's NOCASE folds ASCII alone |
numeric decimal | no equivalent — --cast required |
json jsonb | json, its numbers as written; a path reads into it (Objects and paths) |
Types with no equivalent, and --cast
Types without an equivalent are not silently rounded: say what you want with
--cast <field>=<type>. On PostgreSQL,
--cast price=text preserves a decimal exactly. In SQLite a
decimal is already stored as an int or a
float at the source, so the exact value is gone before the import
starts.
Filtering
--where keeps only the rows that match a FennecQL expression,
written with the new collection's field names. It works the same on both
sources.
fennec import data.sqlite --table docs --into articles \
--where 'category = "book" and score >= 10 and tags has "rust"'--source-where(PostgreSQL only) filters on the server in SQL, so skipped rows never travel.--limitcounts rows that pass the filter.
Why --where and --source-where are two flags
--where is a FennecQL expression and behaves identically
on both sources: it is applied after the row becomes a document and before it
is written. The field names are the target schema's — the same expression you
would later write with get.
On PostgreSQL there is also --source-where, which goes into the
SELECT inside the COPY so non-matching rows never
travel over the wire. That one is SQL, not FennecQL. They are separate
flags on purpose: one is a portable expression, the other a win pushed down to
the source. Both can be used together.
fennec import postgres://... --table docs --into articles \
--source-where "year >= 2024" --where 'tags has "rust"'With a local --where in place, --limit is not
pushed to the source: cutting on the server first and filtering locally
afterwards would yield fewer rows than asked for. --limit always
counts rows that pass the filter.
Following changes
With --follow the import keeps running after the copy,
applying the PostgreSQL table's changes as they commit. Run the same command
again and it picks up where it stopped.
$ fennec import postgres://app@db:5432/app --table docs --into articles \
--index "category@hash" --follow
source app@db:5432/app -> docs
tls db:5432 with sslmode=verify-full (the default for a host off this machine): TLS, its certificate's chain and name checked
target articles.fennec -> articles
follow slot fennec_articles (created), publication fennec_articles (created)
note the slot keeps the server's WAL until this follower confirms it; to stop following for good: select pg_drop_replication_slot('fennec_articles')
copying there is none yet
100000 records, articles.fennec (339.37ms)
following docs: ctrl-c stops, and the same command resumes
42 transactions, 57 changes, at 0/2BEA458- The server needs
wal_level = logicaland the table an integer key; nothing is installed on it. - Nothing is lost or applied twice when the connection drops or the follower is killed.
- Drop the slot when you stop for good, or PostgreSQL keeps its log for it. A follower that stops waits up to 3 s for PostgreSQL to let the slot go, so a drop right after is not refused as "active for PID"; a second ctrl-c stops that wait.
- TLS is the connection string's,
sslmodeand all, as for the copy (TLS).
How --follow reads, resumes and confirms
With --follow the import does not end at the copy: it keeps
applying the table's inserts, updates, deletes and truncates as they commit,
until it is interrupted. Run the same command again and it picks up where it
stopped, without a second copy.
It reads a logical replication slot through PostgreSQL's own
pgoutput, so nothing is installed on the server. The
publication and the slot are made when missing (--publication,
--slot; both default to fennec_<into>). The
server needs wal_level = logical, and the table needs an integer
key that becomes the document id, since a changed row has to be found again.
It must also be in the replica identity: the primary key, or
replica identity full.
- A row arrives as the copy would have written it. The stream goes
through the same type mapping,
--cast,--vectorand--whereas the copy. A row that stops passing--whereis deleted from the collection. - Nothing is confirmed before it is on disk. The slot only moves
past a transaction once an fsync has covered it. A broken connection or a
killed follower starts again from there, and the writes it replays are
puts and deletes by id, so applying them twice changes nothing. While
the table is quiet, the server's keepalives name how far its log has
gone; over a connection whose server is proven — on this machine, under
verify-caorverify-full, or signed in bound to the TLS session — the follower confirms that position where nothing of its own is pending, as PostgreSQL's own subscriber does, so the slot lets go of the log other tables' writes fill. Over any other it confirms only what it received and put on disk, aspg_recvlogicaldoes: a keepalive there may be anyone's on the path, and a position confirmed past what was received would have PostgreSQL skip every change before it, for good. The slot then keeps the server's log while the table is quiet, until its next change. - An untouched vector is not resent. A vector of 768 floats is 3 KB, past PostgreSQL's TOAST threshold, so an update of any other column arrives without it; the follower takes it from the collection.
- A copy is resumed only when it is whole. A small
_followcollection in the file records which collection follows which slot and whether its copy finished. A copy cut short, or one whose slot was dropped in the meantime, is made again rather than streamed on top of, and a collection the follower did not copy is never replaced.
Measured against the Makefile's server, 10 000 rows with a
vector(384), the mirror a file (make
follow-bench):
| vector(384) | vector(768), TOASTed | |
|---|---|---|
| commit to visible, one row a transaction | p50 0.16 ms, p99 1.56 ms | p50 0.16 ms, p99 1.57 ms |
| one transaction updating every row | 40 400 rows/s | 52 600 rows/s |
| 2 000 one-row transactions from one client | visible 0.3 ms after the last | 0.2 ms |
| a connection the server cut | 553 ms | 536 ms |
The slot keeps the server's log until the follower confirms it,
for as long as it exists. To stop following for good, drop it:
select pg_drop_replication_slot('fennec_articles'). PostgreSQL
13 and later can cap what a forgotten slot holds with
max_slot_wal_keep_size.
A follower that stops lets the slot go before it exits, within 3 s. It ends the stream the way the replication protocol ends one and waits for PostgreSQL to release the slot, so a drop, or a follower started again, finds it free. PostgreSQL answers at once unless it is decoding a large transaction, of any table. Past 3 s, or at a second ctrl-c, the follower closes the connection and prints a warning that the slot is still held: PostgreSQL then releases it when it next reads the connection, once it is through that transaction, and a drop until then is refused as "active for PID" — run it again a moment later. If the connection broke instead, the warning says the slot may still be held. A follower started again waits that out by itself, as it does after a follower was killed, which cannot end its stream at all. A follower that stops on an error closes the connection without waiting. The 3 s bounds only that wait: the rest of a transaction is applied before it, and the file's checkpoint written after it, however long they take; a kill in the middle of them loses nothing that was confirmed.
The follower is the file's only writer, as every fennecdb file has exactly
one: stop it to open the mirror elsewhere, or serve the mirror from the
server that follows (below). A column added to the
table after the copy is reported and left out. A column the collection needs
that is dropped from the table stops the follower.
--source-where and --limit do not combine with it:
the first narrows the copy but not the stream, and a mirror keeps every
row.
Serving the mirror as it follows
fennec-server --follow runs the follower inside the server, so the
table is served over HTTP and subscriptions while it follows.
$ fennec-server --file articles.fennec --http 0.0.0.0:8080 --http-token "$TOKEN" \
--follow postgres://app@db:5432/app --follow-table docs --follow-into articles \
--follow-index "category@hash"
opened: articles.fennec
following: docs
fennec-server 0.2.0: articles.fennec [sync=250 ms]
fennec-http 0.2.0 listening on: http://0.0.0.0:8080 [token]
follow: db:5432 with sslmode=verify-full (the default for a host off this machine): TLS, its certificate's chain and name checked
follow: docs: slot fennec_articles (created), publication fennec_articles (created)
follow: the slot keeps the server's WAL until this server confirms it; to stop following for good: select pg_drop_replication_slot('fennec_articles')
follow: copying docs: there is none yet
follow: 2000 rows of docs copied
follow: docs copied, 100000 rows in 160.10ms
follow: docs: streaming its changes- Import options take a
--follow-prefix:--follow-index,--follow-castand so on. - The mirrored collection is read-only to clients (403); the rest of the file takes writes.
Running the follower inside the server
A second process over the follower's file corrupts it, so serving the
mirror took a copy of it and a process of its own. fennec-server
--follow runs the follower inside the server instead, over the file
the server serves: the table is served over HTTP and subscriptions as it
follows, with no second copy.
Every option of fennec import that says how a row becomes a
document — --index, --vector, --cast,
--id, --where, --batch — is taken as
--follow-index and so on, as are --follow-slot and
--follow-publication. The collection takes no write but the
follower's: a client's is refused with 403, since the next
change from PostgreSQL would write over it. The rest of the file takes
writes as ever. A subscriber of the collection
(GET /articles/changes) hears each change as the follower
applies it, and so does a replica of the server.
The first copy holds up nothing of the server's. It is read from
PostgreSQL with no lock held and lands a batch (--follow-batch)
at a time, each its own write, so every other request is answered as it
goes. A reader of the collection sees it fill as the batches land; its
_follow entry says the copy is unfinished until the last one,
and an unfinished copy is made again from the start by the next start. A
stop, or the shutdown, ends the copy within 0.2 s wherever it waits on
PostgreSQL, and the dial and sign-in within connect_timeout,
so neither a slow table nor a server that answers a byte at a time holds
the server up.
The PostgreSQL it follows is trusted that far: what it sends is
the collection's content, and a follower that cannot go on — a change it
cannot read, a column the collection needs dropped — stops the server on
purpose, exit code 1, rather than serve a mirror that no longer moves.
Whoever answers at the follower's address can therefore stop the server;
only verify-full (the default off this machine) and a sign-in
bound to TLS keep that to the server itself. Its words in a log line are
escaped and cut, never written raw.
The follower stops with the server, before the shutdown's checkpoint: its last changes on disk and confirmed, then its slot let go, which it waits up to 3 s for, as the command does, within the first 5 s of the shutdown, which gives the follower no more. A server started again at once streams from the slot rather than finding it taken. If the follower could not wait long enough — it logs that the slot is still held — or the shutdown's 5 s ran out first, PostgreSQL lets the slot go once it next reads the connection, and a server started again retries until then. A server killed outright starts the stream again from what it last confirmed; the changes it applies again are puts and deletes by id, so nothing is lost and nothing comes twice. An error the follower cannot wait out ends the server at once, exit code 1, and so does a bug that ends the follower's thread, rather than leave it answering from a mirror that no longer moves.
Against the Makefile's server, 10 000 rows with a vector(384)
under an HNSW index, a subscriber reading /changes over HTTP
(make mirror-bench):
| commit to the subscriber | p50 | p99 |
|---|---|---|
| an update of a title | 0.09 ms | 4.00 ms |
| a row inserted with its vector, put into the graph first | 0.19 ms | 3.34 ms |
Commit to visible in the file, with no server between
(make follow-bench), was 0.16 ms at the median on the same
machine. Killed while the table took a row a transaction, the server was up
again in 75 ms and held every one of the table's 14 063 rows 370 ms after it
started. The follower adds 178 KB to fennec-server.
Vector columns
A column of embeddings becomes a vector field, and an
@hnsw index named with --index is built once every
row is in. pgvector's columns are recognised with their dimensions; a
SQLite BLOB of little-endian f32s is named with
--vector.
fennec import data.sqlite --table passages --into passages \
--vector embed:384 --index "embed@hnsw(cosine)"
fennec import postgres://user@host:5432/database --table passages \
--into passages --index "embed@hnsw(cosine)"$ fennec import data.sqlite --table passages --into passages --vector embed:384 --dry-run
source data.sqlite -> passages
target passages.fennec -> passages
create collection passages (
text text <- text
source text <- text
embed vector<384> <- blob
)
id <- id (INTEGER PRIMARY KEY)
nothing was written (--dry-run); use --count for the row countHow vector columns are imported
The graph is built after the copy, over every vector at once and on
every core, which is the order a bulk load wants (Bulk load first, index
after). pgvector's vector, halfvec and
sparsevec columns become vector<N>,
vector<N, f16> and sparse<N> with
nothing named; --follow keeps them in step as any column, an
untouched vector taken from the collection rather than resent (Following changes). A NaN or an
infinity in a value bound for a vector field — one of pgvector's, a BLOB
under --vector, a float[] named with it — stops
the import at its row, naming it: no distance orders by one. So does a
component past what the field holds, a float8[]'s
1e39, whose f32 is an infinity, or one of
65 520 or more bound for a vector<N, f16>, which an
f16 rounds to its infinity, named in the engine's words (limits). A
float or [float] field keeps its
NaNs and infinities, as PostgreSQL holds them (Collections and types); SQLite stores a
NaN as NULL, and a text NaN read
into a float column is one. A decimal past a float's range — a
numeric's 1e400, one in a jsonb,
a SQLite text's — stops the import at its row, naming the column and the
number: read as a float it would be an infinity or 0, another number than
the one held (limits).
Speed and testing
100 000 rows × 3 dimensions, index build included, take about 3.1 s from either source.
make import-test # the PostgreSQL arm and --follow, TLS on in the server — needs Docker
cargo test -p fennec-import --test all -- --ignored pg:: follow::What the import adds to the binary
Import is a default feature of the fennec binary and accounts
for 275 KB of it, and its TLS, the tls feature, for 1035 KB more
(--no-default-features --features import,backup,mcp keeps the
import without it, prefer then plain text).
--no-default-features removes both, and fennec
backup, archive, restore and fennec
mcp with them (1876 KB). Those three figures are the
release profile's on macOS arm64. As a release builds it, on
the cli profile, fennec is 5027 KB on x86-64 Linux,
and 2983 KB without its default features (make small), as CI
measures them.