What is difference between Numeric and Integer types, and how I can use timestamp level type in Mondrian? - mondrian

While reading manual of Mondrian I found that it has not so much types including Integer and Numeric - what's difference between this types?
And how can I use timestamp level type?

Well, Integer type can contain only whole numbers, like 5 or 123.
Numeric type can contain decimal numbers like 15.39.
About the second question: I think you're asking about Time dimensions, not the Timestamp (which is type). In this case it's better to refer the Mondrian documentation:
http://mondrian.pentaho.com/documentation/schema.php#Time_dimensions

Related

How are null values stored in MonetDB

I have a column of 4 byte integers that contains a lot of Nulls. I would like to know how are null values represented in storage. Do they use up 4 bytes as well or they are handled in a way they don't waste space?
It depends on the data type. For example, in the case on numerical types (int, float, etc) nulls are represented as minimal value of the type. As a result, no extra space is wasted, but one cannot use the smallest possible value for that type.
For other types, such as boolean columns, some extra space is used, since single bit is not sufficient to represent true, false and null. (It's not a qubit ;) )
You can find more information here: https://www.monetdb.org/Documentation/Manuals/SQLreference/BuiltinTypes
The link below provides more developer targeted info (with more details): https://www.monetdb.org/wiki/MonetDB_type_system

performance type varchar(1) or smallint to store status Postgres

I'll store a status from 0 to 7 and I want to know which is the better type field to store, considering performance and space on Postgres database: varchar(1) or smallint.
By the way, is there any difference to set a field varchar(1) or varchar(100), still talking about performance and space?
In my opinion you're fighting the wrong battle. You're worried about the performance impact of storing an integer instead of a single character field, which in my opinion is short-sighted thinking. The actual impact on performance of an integer vs. a single character is trivial, and I doubt this can be measured meaningfully. In my experience it's more important to reduce the cognitive loading on the developers and users of the system, and thus it's better to use character fields which are long enough to contain a reasonable description of the status instead of numeric values or single character abbreviations. Not having to remember what 1, 2, 'A', or 'X' mean is very helpful. Instead of these abbreviated values I suggest using easy-to-understand values such as 'READY', 'ACTIVE', 'PROCESSED', 'CANCELLED', etc.
As to the second part of the question - not really. There might be some trivial amount of time to move the longer string, but it's trivial unless you're talking about millions of values.
Best of luck.
While I agree with Bob Jarvis that this is really premature optimisation, I'll try to focus on the question as asked.
You're neglecting the most important choices. Your choices include:
smallint
enum
"char"
character and character varying
You could use an enumerated type. This is only really OK so long as you expect never to remove valid values, since PostgreSQL currently doesn't support deleting values from enum types.
Alternately, you could use the "char" data type. Yes, the quotes matter. It's a single character, like the C data type char. Without quotes char turns into character(1) at parse time.
varchar and character aren't really ideal for this because they're variable-width types with header overheads etc.
By the way, is there any difference to set a field varchar(1) or varchar(100), still talking about performance and space?
No. This is answered (many times) in other questions.

For SQL like queries in MySQL and sqlite which more efficient for comparison text or int

I need to store 2 columns in SQLite db. a date (YYYY-MM-DD) and a time (HH-MM-SS)
Since SQLite can store date time in TEXT, REAL, INTEGER only which data type should I use ?
Is it more efficient to store as TEXT or INTEGER. I will be doing frequent lookup against these columns.
So my queries will have a WHERE condition on the date and time columns.
I want to make the WHERE comparison efficient
The primary bottleneck when using databases is I/O.
If you care about performance, use the datatype which requires the least amount of I/O.
An INTEGER value needs less storage than a REAL one, which needs less than TEXT.
Whether this makes a noticeable difference is another question; you have to measure.

Performance impact of index datatype in MongoDB?

I need a new Mongo collection that associates data with an IP address, the address being the collection key. I'm wondering if there's any performance advantage using the decimal notation of the IP adress (e.g. 3299551096 as an integer) instead of the dotted notation (e.g. "198.252.206.16" as a string).
I haven't found any evidence for or against, nor any performance comparison between integer and string indexes. Is there any reason to prefer one over the other?
An integer value storage requirement is smaller, but of course, not very significant. The sorting/indexing algorithm for a number would be slightly faster than a string normally, but the difference would be extremely small as the string is also very short.
I wouldn't expect a compelling performance difference between the two. If you're planning on storing IPV6 addresses, the issue will be that BSON (http://bsonspec.org/#/specification) doesn't have a simple data type for storing a 16-byte number, so it's not necessarily a natural fit to store as a number only.
In the end, I'd likely just use strings if you want to avoid doing translation from storage to screen, or if you want to make queries more natural to write for most of us :) :
db.ips.find({addr: "192.168.1.1"})
If using strings, I'd also suggest you consider storing as a fixed format string such as 192.168.001.001 if you want to do more complex searches, such as a range search. Since a string stored with a consistent fixed format will sort naturally, you can use it in more ways than you'd otherwise be able to. If ranges aren't important, it's not necessary to store this way.
With a fixed format, you could do a query like:
db.ips.find({ addr: {
$gte: "192.168.000.000",
$lte: "192.168.000.255" } })
That would find all IP addresses between (inclusive) 192.168.0.0 and 192.168.0.255.
Ideally, you'll have an index on the field either way:
db.ips.ensureIndex({ addr: 1 })

Representing large numbers in Dynamics CRM 2011

I'm trying to represent numbers larger than 100,000,000,000 (the maximum of the Decimal data type) in Dynamics CRM 2011. It seems like the only way to do this is to either use the Currency field or use a text field. Neither of these options are very appealing.
What is the best way to represent large numbers in Dynamics CRM?
The only way is indeed in a currency field or use a text field. You can't increase the maximum value of a decimal field.
However the Float-Field covers until 100,000,000,000 if that's any comfort.
One possible answer is to just store in billions (2.15 = 2,150,000,000) - though this won't work if you're adding small numbers to a large number.
Another approach is to add a 'multiplier' field that contains a thousand, million or billion - and multiply the numbers together when required for reporting.
Finally, you could store the number in a string and validate/copy it to/from the number property in RetrieveMultple and PreSave plugins. As long as you're not saving the large value in the number field, you can use it to hold transient large values. Use a string as a persistent holder. Hacky, yes - but at least you can then use the value in charts etc.
The 'currency' type is unstable to use

Resources