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 4 years ago.
Improve this question
I am developing an app which requires to generate an id for new users I want to do it with the smallest number of characters that allows me to create 100 billion diferent possible ids so how should I do that and how to avoid giving two users the same it? Should I look if that id exists? Should I use a random id generator or give ids in order like 001 002 and so on?
This depends entirely on what kind of functionality you expect from this id, do you intend for these id's to correlate with persisted data, such as a database? If this is the case, it might be more prudent to let the database handle the unique ID generation for you. Otherwise, using sequential values such as 1,2,3... etc would probably be ideal. unsigned long will keep you covered for the first 2 billion users... If you somehow go beyond that, you can rethink your data storage then.
The question is very broad.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 days ago.
Improve this question
I have this requirement where I need to dump a large array of user Ids in one of the columns of a table in PostgreSQL DB. Let's say the max number of user Ids would be 100,000 and each user Id is of max 50 characters length. I won't be performing any operations on that table, it is just for logging purpose.
I've used text[] type column to dump those array of user Ids. I don't know if its the best way to do. I'm worried that some "max size limit reached" error gets thrown if the length of the array increases in the future.
Please suggest a better way to achieve this :)
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 8 years ago.
Improve this question
In my application, it shows student's subject and it's result. First, I have written this application to show the subject and results only. But, now we need to extend it's functionality to update subjects results from admin panel.
Problem is in my database, I have recorded results, if the student has taken-part in the given subject. As an example if a student is absent for mathematics, in the application subject will be printed without results for mathematics.
What I need is to update the results for each student. What I have noticed was, I need to write update, insert and delete queries to update student's results.
I don't want to handle 3 queries. I am looking for more flexible way of doing this.
One solution, I came across is, update database manually. That is if the student is absent for any given subject, update results to 0 and keep the record. so in admin panel, I need to use only update query.I am not sure where this is ok from database concepts.
Is there any better solutions?
I didn't understand your question... may be this will be useful check this one
$var=1;
update tablename set col=col+$var
you can directly add value without retrieving previous value.
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.