On 2021-11-03 19:14, Ertan Küçükoglu wrote:
> My application will save about 100-300KiB XML files (E-Invoices) in
> one of the tables as BLOB binary (for UTF8 and such reasons).
You could just use BLOB SUB_TYPE TEXT CHARACTER SET UTF8 if your only
concern is UTF8. However, if you receive XML with different character
sets, then using BINARY is a good idea.
[..]
> When considering performance and only performance;
>
> 1) Is it advisable to use a separate foreign key table for BLOB data
> only, or do I just continue and save everything in a single table?
Larger blobs are always stored separately from the row data, and are
retrieved separately. The row itself only contains an 8 byte pointer to
the blob. So using a separate table is not necessary.
> 2) I would like to have suggestions about GUIDs and indexes on varchar
> GUID columns. What I read here and there is that it is better not to
> use indexes on such columns (other database system users like SQL
> Server or PostgreSQL suggest that if my memory serves me well). My
> case, I must use them for this project. Also Firebird might have a
> different handling of indexes which is immune to such column values. I
> do not know.
Given your size requirements, I don't think you need to worry about this
at all. But I would recommend using CHAR(16) CHARACTER SET OCTETS
instead of CHAR(36) CHARACTER SET ASCII. As far as I know, the primary
concern with using UUIDs as primary keys is for index-organized (aka
clustered) tables. For heap-organized tables like Firebird uses, that is
not a big concern, though there might be some churn for index updates,
but I would guess (but have never tested this!) the impact of this is
negligible (especially in the low volume of inserts you mention). The
suggestion of Dimitry to use a 'serial' UUID and reverse it for the
primary key adds a lot of complications that are not warranted for your
situation.
Mark