-
Notifications
You must be signed in to change notification settings - Fork 877
Closed
Milestone
Description
As part of our size reduction effort for NativeAOT (#4799), we could introduce an alternative data source builder that starts out with only the minimal functionality, and allows opting into specific things. The existing NpgsqlDataSourceBuilder would continue to bring everything in, preventing breaking changes and not burdening users who aren't interested in binary size (the majority, currently).
Some thoughts:
- Make encryption (SslStream) opt-in (#4966). This means abstracting all usage of SslStream behind something that would only be reference if AddEncryption() is called on NpgsqlSlimDataSourceBuilder
- Make arrays, ranges, multiranges opt-in (each via a different API). We should make bring back ranges/multiranges to the regular NpgsqlDataSourceBuilder by default.
- Make various type categories opt-in. The obvious categories (which are seldom-used) are:
- The geometry types (e.g. box, circle)
- The network types (IP, macaddr)
- ltree
- Special internal types (oid, oidvector, xid...)
- Enums, composites? Note that here we already have an API gesture (MapEnum, MapComposite), maybe we can refactor to get rid of their handlers/overheads if those APIs aren't called
- XML, hstore, Possibly bitstring
- If we take this to the extreme, we could allow a real bare minimum of types (int/string/date/timestamp) and require per-type opt-in (AddInt(), AddString()... /cc @Brar). I think this may be going a bit too far - if all the above are stripped by default, we'll probably land in a very small place anyway, which should be sufficient.
- If we think this approach is interesting, we could have a 3rd builder type ("NpgsqlTotallyStrippedDataSourceBuilder") for this hard-core mode; but I wouldn't do it unless we see that the gains vs. the silm one would be worth it.
- Maybe there's some potential for getting rid of globalization/encoding/ICU stuff, not sure.
Reactions are currently unavailable