New answers tagged

2

The database can only hold 1 write concurrently and does not support transactions. If this value is exceeded, the database responds immediately with an error code XXXXX. This is extremely bizarre for any modern database, but let's accept the premise. At a high-level, there are 2 approaches to concurrent data modifications: Pessimistic - This is lock-...


2

Reading the specs, the main point of your requirement is: An user should receive an immediate response that vote was accepted. To achieve that, you could separate out the vote-taking-part. Each of your two instances need to talk to a component responsible for that. Then the problem arises, this component becoming the bottleneck in your architecture. ...


0

The database can only hold 1 write concurrently and does not support transactions Lack of transaction is the main issue. I would suggest: If possible, update to a different RDBMS capable of transaction, e.g. Postgres. You really need ACID properties (or at least an RDBMS capable of locks), so that is the only honest and professional solution. otherwise, "...


0

Only up to a point As a software developer, you'll probably have to query and update the database, and knowing how the DB operates is critical to avoiding bad queries, inefficient joins and so on. You might have a dedicated DBA who can decide where to add indexes ir partition the database, but you can't count on it, not in small companies and not always in ...


0

Understanding how things work under the hood will help you debug your queries for performance & storage considerations. For example, a range query will perform better with a B-tree type of index. And when doing joins, you can add hints to the query engine on whether to use HASH or MERGE joins. And on the physical side, you can distribute tables in one ...


0

It is absolutely worth the time! Being a full stack developer enables you to efficiently produce value-added solutions. I've seen all too often communication breakdowns and silo'd development... Triple the development time and half the quality. At the end of the day, the more skills you have, the more valuable you will be.


2

Don't discount the possibility that you'll need to actually go into the database and query it directly as part of a debugging process. If you ever end up doing that, you'll definitely want to know all about the database technology and how your particular database is structured. Maybe it won't happen. But if it does (and in my experience it always does at ...


8

A few years ago I worked on an application that was written by somebody who had clearly never learned how SQL databases work. I was given a problem report to fix -- the main status summary page, which had always been slow, had now started to be so slow that it was hitting the server script execution timeout (of 3 minutes) during rendering. It seemed that ...


1

The guiding principle at work here is probably "if you ever need to run a query on the data, and not just display it in its native form, then the data needs to be first-class rows and columns, not some JSON stuffed into a single field."


0

When you have a code enumeration that is used to drive business logic in code you should still create a table to represent the data in the DB for the many reasons detailed above/below. Here are a few tips to insure that your DB values stay in sync with the code values: Do not make the ID field on the table an Identity column. Include ID and Description ...


1

I think most applications should have them. These values are more of a convenience for trouble-shooting and other support needs. Soft deletes have benefits as well, but you always have to include them in your query logic. Just because you can use them, they're not enough. Many auditing needs require more data and sophistication even beyond logging. ...


3

would it be a 'bad idea', to implement a policy/practice to always persist data and to always implement 'auto-updating' (if possible) created, updated and deleted properties? Persistence and auditability (not stated but implied) are valuable goals, and it is good to think in that direction for cases where you need them. That said, to answer your questions: ...


3

Let's take the example of a major ERP on the market: all the master data and most of the transaction data carry 4 fields: the author and the time stamp of the record creation and of the last record modification. all the critical field changes (it's customizable what is critical) are logged with the author of the change, the timestamp of the change, the ...


3

No, it is not too verbose. I'd say it's close to being a best practice. Having created and modified dates on a per record basis allows one to see how stale that particular data row is. Most systems I have encountered have data retention requirements. By having these dates, one can have a data purge process to keep only a certain amount of data in a ...


0

From Msdn, you need to use the TableAdapter that is created: If you do not have an instance available, instantiate the TableAdapter you want to use. Example: NorthwindDataSetTableAdapters.RegionTableAdapter regionTableAdapter = new NorthwindDataSetTableAdapters.RegionTableAdapter(); regionTableAdapter.Insert(5, "NorthWestern"); Check the ...


0

Server should expose those REST services, which fullfil your need in front-end for the single page application. When an application is developed which acts as the client for the data available through REST services, there is quite often communication between the back-end and front-end team. Because of this and the demands from the front-end team, the REST ...


1

The general term for having off-line "child" databases is replication. I don't believe there is standard term for those child databases only containing a defined part of the central database. Call it partial replication, if you like.


1

If the goal is just to save some disk space, I think it's a bad idea: look at the cost of the GB today, compare it to the cost of the time of those who write reports and querries and have to figure out what's in the field, and how to address a specific bit, the cost/benefit comparison might end on the wrong side. if you're working with an SQL database, ...


2

The only advantage to using bitmasks is if the bit fields' meaning is not static. Relational tables only work well if you know ahead of time what each field is on a record: you have to identify the fields in the CREATE TABLE DDL statement after all. If the meaning of each bit field is configurable at runtime, or otherwise not known ahead of time, then it ...


0

Think about security too. If you identify these records EVERYWHERE by data that may be sensitive - will there eventually be sensitive data somewhere it shouldn't? 'Shouldn't' being defined by requirements, client needs, and the Data Protection Act. It might be 'encrypted', but I assume if you want it for efficiency of cross-checking - it won't be heavily ...


0

Including information in the Id of the record: The upsides: Minor (but debatable) initial convenience to the few humans who need to read the underlying data store. The downsides: Nearly impossible to make changes. What happens when the Id suddenly needs to include information X? What happens when information X needs to be removed, or becomes ...


14

If you're really, really, really strapped for disk space, then you might consider bitmaps for user permissions. If performance is your worry, then forget about them altogether, because picking them apart will actually be slower. You can't index a bitmapped field meaningfully, resulting in database table scans, which are [almost] always a performance killer....


-1

There was a discussion about whether it was desirable to have information about each person encoded in their ID number. Encoding multiple items of data into a single field is Bad Design if for no other reason than it breaks basic Data Normalisation rules. Alternatively, it could contain no semantic content at all. That would be my choice. On ...


35

I work with an application that uses bitmasks to store user role assignments. It's a pain in the butt. If this makes me biased, guilty as charged. If you're already using a relational database, it is an anti-pattern that violates most relational theory and all the normalization rules. When you build your own data storage, it may not be such a bad idea. ...


7

Back when storage was expensive, the boon with bit masks was that they saved space. In the days of big data, this isn't the issue it once was. Taking the example you cite - having roles stored as a bit mask would be something of a code smell from a database design point of view as it would violate first normal form. In this sense, they're an anti-pattern. ...


23

You have already named the relevant pros and cons: Bit fields save space. They store data in the record itself, so you don't need JOINs to find them. (But individual flag fields in the record would do the same.) They are badly readable if you want to work productively with raw SQL output. Deciding what to do requires more info: Just how scarce is disk ...


0

You are basically inventing a database on top of a database. A relational database already have a system to represent properties for entities - it is called tables and columns. By creating your own system on top of this, you are introduction a layer of complexity and at the same time loosing many of the benefits of a relational database. For example this ...


0

I sincerely doubt it. I'm fairly sure that XE only supports one database per machine. Any more than that and you owe Our Friends in Redwood City [a lot of] money. Depending on your application/ data structures, you might be able to use separate schemas inside the one database.


2

Most databases have tables that store schema information about tables that are being maintained. For example, in SQL Server: SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = @Table ORDER BY COLUMN_NAME Will get you a list of columns for a particular table. However, in your case, I would just ...


0

Pretty sure they always iterate in order If not use the Ordinal There is a DataType if you have a standard format for a type Dictionary is not going to be the easiest syntax but it will be the fastest Dictionary<string, int> dicColMap = new Dictionary<sting, int>(); foreach(DataColumn column in table.Columns) { Console.WriteLine(column....


1

This approach is pretty common in workflow applications. Business logic may not be in database tables but it can often be dynamically loaded by the system and designed by domain experts. Workflow foundation may be worth a look.


2

You could create a table that stores courses that can be taken with each other: CourseCombination (id, course1id, course2id). Then you could create a table that stores a single value representing the time frame a student can take any given combination of courses: CourseCombinationTimeFrame. Then in your application create a place for the system ...


2

Main thing is once the product is delivered, and if there is any need of changing the business logic then they want to be able to that themselves That's potentially a huge issue. You need to be able to scope this, and determine what they're likely to want to change e.g. switch between a couple of behaviours? Then provide a config/flag to provide that ...


2

I think you're overthinking things. You can use a traditional SQL-based RDBMS. It may or may not be fast enough (although I suspect you're worrying prematurely about optimization), but the only way to tell would be to try it. Just make sure that you write your code that interacts with the storage system in an abstract-enough way that it is simple to ...


0

... As far as I know its just a MVC framework for Ruby web development. Some articles talk about ActiveRecords ORM and other subjects in a way that it seems that those gems are almost exclusive for Rails development. Is that only because Rails is very popular, almost more than Ruby itself, and because of that most blogs are from Rails guys so they talk in ...


1

5Mb seems like a trivial amount of data these days. So I wouldn't worry about pulling that out on demand, deserialising and manipulating that. Performance shouldn't be a problem given your quantities of data If there are no projected format changes for this data, I would stick to this approach.


4

Put the data in a data base. Write a function which pulls all the data from the database and populates the arrays. Pass the populated arrays to the unchanged calc function Write a function to write a database using the resultant arrays from the calc function.


1

I asked the same question years ago and actually built the app both ways. The build-my-own database version was a lot of fun, but it was a toy. Using a real database enabled a commercial product that performs well under stress. SQL Database SQL lets you write one-liners for most of the kinds of reports you are talking about - one-liners that other ...


5

making queries on things like temperature to sales of specific categories of products This (Queries) is one area relational databases are designed for. You are better off with a database with SQL support.


0

I've approached this by applying a delta. To do this in the database you could add a flag column that you change each run. The updates can be applied in two passes. Apply the new data flipping the flag on existing records that match, and adding and new records with the new flag value. Delete all records that have the old flag valued. To limit the ...


-2

I love sql, and couldn't stand seeing it chopped up in string literals, so I wrote a little VS extension to let you work with real sql files in c# projects. Editing sql in its own file gives you intellisense for columns and tables, syntax validation, test execution, execution plans and the rest. When you save the file, my extension generates c# wrapper ...


3

Fowler is only referring to the mapping between the in memory representation of the document and the document itself, not the persistence of changes made to the representation. You would still need to separate the responsibility of persistence from the domain model. The key here is that you would have no mappings between those two responsibilities, so ...



Top 50 recent answers are included