Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Assume a query that performs (multiple) joins. A join operation can lead to both, more columns and more rows in the (intermediate) result.
It is easy to imagine an intermediate 2D format that "grows" from join to join. However, data will be copied around a lot in memory.
I wonder if this is actually done in efficient database implementations or if there is different strategy in use?
e: For example there are two obvious ways to produce intermediate tables (2D): such that data of each row or data of each column is consecutive in memory. depending on operations, each arrangement may have benefits or drawbacks (scans of less data vs access with bad locality). Surely, there are more advance variants as well.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am a newbie in Cassandra.
Does Cassandra follow any specified sorting algorithm like bubble sort, binary sort, etc.? If not, How does it sort in order by command?
It doesn't, or at least it shouldn't. In Cassandra you build your data model around your use cases. So if you want to retrieve sorted data you have to store it sorted. If you want the same data sorted in different ways, you store the same data multiple times sorted differently. There is a lot more to read about how Cassandra works, and I think every user of Cassandra should.
Links related to your question:
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSimplePrimaryKeyConcept.html
https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCompoundPrimaryKeyConcept.html
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateIndex.html
Getting started with Cassandra:
https://academy.datastax.com/courses (the first two courses is a must do. You need to register but they 100% free)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is NSOrderedSet faster than NSSet? Has anyone done any tests where on is better over the other? If not why was NSOrderedSet introduced in the first place?
NSOrderedSet
The point of using an ordered set is that it is traversable in its original order in which items were added to it, and querying whether an object is contained is faster than for an unordered array. The "contains" operation (and set operations that build on it) is however slower than the O(1) that's possible with an unordered set for that operation.
Unordered set
The point of a set is that it allows for a best case O(1) "contains" query time. It is the data structure you should use out of these two when you need as fast "contains" time and do not need to retrieve the items in the structure in any specified sort order.
It is internally probably implemented as a hash map, although it's not pointed out in the Foundation documentation.
I'd advise reading this great blog post regarding the different uses of the different Foundation data structures.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I received a list from a customer using bullet points, and then sub bullet points. What is the best way to store these in a Postgres database, if you could give me an example of this, that would be great.
Thanks!
Structure of it is something similar to this:
Defect1
possible instance of defect1
another possible instance of defect1
Defect2
possible instance of defect2
another possible instance of defect2...
For indented lists you're basically talking about a tree structure. There are many ways to store hierarchies. See this answer for a comparison.
Design Relational Database - Use hierarchical datamodels or avoid them?
Depending on how you want to use the data, i.e., if you're just going to spit it back out as it came in, you may be able to skip the hierarchy aspect in this particular use case and just store each line in sequence with an indentation field. It won't do nearly what can be done with a tree, but it may be all that's needed in your particular case.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am attempting to come up with a Database Design that works well for a specific division of my company.
Basically, I have a list of Account Numbers with a ton of fields associated with them. My division needs to compare how these fields change over time (What was in that field for this account number a year ago?).
I am currently thinking of a very linear approach where I use only one large table for the data that is time stamped so a table would have the name AccountInfo04012013 and then the next month would be a new table called AccountInfo05012013. This way we can make comparisons between any two months.
What are the drawbacks of this plan? and what should I be doing instead?
You are going to have to use timestamps. All database managers will have this built in.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a large file that contains a particular structure.I want to know the top 10 most commonly occurring values for a particular fields in the structure.Will I be able to do it in a single parse?
You'll need to store and update an associative array that contains the field and number of occurrences. Depending on how many different fields there are, your memory will be the limitation.
After that's done, do a sort of the array based on the value.
AFAIK, C does not include an associative array data type, so you'll need to use a 3rd party library, see Looking for a good hash table implementation in C for some options.
As for sorting, there is http://linux.die.net/man/3/qsort.
So ignoring possible memory requirements, you can do it in one pass.