String length data for DynamoDB - amazon-dynamodb

I try to convert the string length of 400KB (the maximum size of a DynamoDB item) to characters.
I don't know if KB is kilobytes (in this case 400 000 characters) OR kilobits (in this case 51 200 characters).
Do you know that ?
Thanks

Definitely 400 KiloBytes. But DynamoDb uses UTF-8 encoding for the strings. So if the your string is UTF-16 encoded, it may or may not fit as one dynamodb item. Secondly the 400KB limit also includes the binary length of the attribute key names you have in the table.
How many characters can UTF-8 encode?
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items

Related

How to set max length for a String field in DynamoDB?

Can you constrain the max length of a string field?
The documentation describes only the internal limits for a field.
Strings are Unicode with UTF-8 binary encoding. The length of a string must be greater than zero and is constrained by the maximum DynamoDB item size limit of 400 KB.
The following additional constraints apply to primary key attributes that are defined as type string:
For a simple primary key, the maximum length of the first attribute value (the partition key) is 2048 bytes.
For a composite primary key, the maximum length of the second attribute value (the sort key) is 1024 bytes.
Unlike traditional RDBMS, DynamoDB does not have a notion of "maximal column size". The only limit is an item size limit, which is, as you've mentioned, 400 KB. That is a total limit, it inludes attribute name lenghts and attribute value lengths. I.e. the attribute names also counts towards the total size limit.
Read more in the docs.

Oracle Alias Encoding and Extended Characters

I'm working on a database access layer and have just noticed that Oracle 11g seems to have some issues handling non-latin characters in the aliases.
It seeems that characters over 0x7F, in an alias, appear to count as two characters as far as the 30 character alias length limit is concerned.
For instance in both Oracle SQL Developer and ODP.net:
SELECT
LENGTH('ÔÔÔÔÔÔÔÔÔÔÔÔÔÔÔ') "ÔÔÔÔÔÔÔÔÔÔÔÔÔÔÔ"
FROM DUAL
Works and reports a string length of 15, however:
SELECT
LENGTH('ÔÔÔÔÔÔÔÔÔÔÔÔÔÔÔx') "ÔÔÔÔÔÔÔÔÔÔÔÔÔÔÔx"
FROM DUAL
reports an ORA-00972: 'identifier too long' error.
This seems to imply that the alias string is being encoded in a way that means the accented characters are becoming two characters.
Is this expected and does anyone know what the actual restriction/encoding is here?
I need a reliable way to determine if a provided alias string is permitted.
For what it's worth the Oracle settings are as follows:
Client:
NLS_LANG = ENGLISH_UNITED KINGDOM.WE8MSWIN1252
Database:
NLS_CHARACTERSET = AL32UTF8
NLS_NCHAR_CHARACTERSET = AL16UTF16
column_name in dba_tab_cols is a varchar2(30 byte). That means that it stores up to 30 bytes of data. Your database character set is UTF-8 so each character may require up to 3 bytes of data which would mean, worst case, that you might be limited to 10 characters. Assuming that all your identifiers use valid Windows-1252 characters, I don't think any characters would require more than 2 bytes of storage.
If you're trying to determine whether an identifier is valid from a client programming language
Convert the identifier to UTF-8
Get the byte length of the UTF-8 encoded identifier
Check if the byte length is greater than 30

PL/SQL data type support for size greater than NVarchar2

PL/SQL has data type NVARCHAR2(size) where the size is 32767 bytes; equivalent to 4095 records.
Now, what data type should i give as an alternative to NVARCHAR2 that could support more than 4k records? I have a gridview in asp.net that doesn't support paging. Which datatype is most suitable to support more than 4095 records?
Is this just text? You could use CLOB:
The CLOB data type stores single-byte and multibyte character data.
Both fixed-width and variable-width character sets are supported, and
both use the database character set. CLOB objects can store up to (4
gigabytes -1) * (the value of the CHUNK parameter of LOB storage) of
character data. If the tablespaces in your database are of standard
block size, and if you have used the default value of the CHUNK
parameter of LOB storage when creating a LOB column, then this is
equivalent to (4 gigabytes - 1) * (database block size).
You can check same page for other types (BLOB, NCLOB) for storing large amounts of data.

What is the maximum size limit of varchar data type in sqlite?

I'm new to sqlite. I want to know the maximum size limit of varchar data type in sqlite?
can anybody suggest me some information related to this? I searched on sqlite.org site and they give the answer as:
Q. What is the maximum size of a VARCHAR in SQLite?
A. SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to let you put 500
characters in it. And it will keep all 500 characters intact - it
never truncates.
but I want to know the exact max size limit of varchar datatype in sqlite.
from http://www.sqlite.org/limits.html
Maximum length of a string or BLOB
The maximum number of bytes in a
string or BLOB in SQLite is defined by
the preprocessor macro
SQLITE_MAX_LENGTH. The default value of this macro is 1 billion (1 thousand
million or 1,000,000,000). You can
raise or lower this value at
compile-time using a command-line
option like this:
-DSQLITE_MAX_LENGTH=123456789 The current implementation will only
support a string or BLOB length up to
231-1 or 2147483647. And some built-in
functions such as hex() might fail
well before that point. In
security-sensitive applications it is
best not to try to increase the
maximum string and blob length. In
fact, you might do well to lower the
maximum string and blob length to
something more in the range of a few
million if that is possible.
During part of SQLite's INSERT and
SELECT processing, the complete
content of each row in the database is
encoded as a single BLOB. So the
SQLITE_MAX_LENGTH parameter also
determines the maximum number of bytes
in a row.

What is the maximum size we can give for nvarchar in sqlite?

In SqlServer we can use NVarchar(MAX) but this is not possible in sqlite. What is the maximum size I can give for Nvarchar(?)?
There is no maximum in SQLite. You can insert strings of unlimited length (subject to memory and disk space.) The size in the CREATE TABLE statement is ignored anyway.
What is the maximum size I can give for Nvarchar(?)?
You don't, because Sqlite will ignore anything over 255 when specified inside NVARCHAR(?).
Instead, use the TEXT datatype wherever you need NVARCHAR(MAX).
For instance, if you need a very large string column to store Base64 string values for images, you can use something like the following for that column definition.
LogoBase64String TEXT NULL,
SQLite doesn't really enforce length restrictions on length of string.
Note that numeric arguments in parentheses that following the type
name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not
impose any length restrictions (other than the large global
SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric
values.
Source www.sqlite.org/datatype3

Resources