New answers tagged

0

Do not adopt a set of standard names because you, as the developer, want to. Use the words and the meanings that the users of this application use. If they happen to use the same words for different statuses then that's great. If you can convince them to adopt a common set of words as a change to their day-to-day business practices then that's great too. ...


2

For fast response time and high throughput, it's actually best to keep database connections open and reuse them for subsequent requests. Most database frameworks offer some kind of connection pool mechanism where a request handler can get a database connection for its work and return it to the pool afterwards. Note that the answer referenced by @RomanBoegli ...


0

Consider the database as your data treasury. Hence, it is in your interest to keep traffic through the open door to a minimum. Therefore I suggest you to open the DB connection as late as possible, ideally just right before the query execution, and closing it right after it again. See this answer for concrete implementation.


0

When you are changing the password, with the main concern being maintaining access to the database, here are a few methods: Operate on another database temporarily, if you are only doing reading then you can have a read fail-over Use another user temporarily Similar-- use a MySQL proxy user to have different credentials, but the same permissions If you are ...


0

How is data stored prior to downloading? It probably is not stored but generated on the fly. Today, the bottleneck could be the network, not the processor or the disk. For example, you could use libonion with sqlite and jansson to code such a JSON + database web service. Or Apache Xerces for XML. Read this draft report and look into the source code of ...


1

As I understand your description C and D are called candidate keys. Either one of them could be used alone as the key. The combination of them both cannot be a candidate keys as each is redundant to the other - given a course ID we know the course name, given a name we know the ID. Let's say we choose C as the primary key. Then D is atomic so is in 1NF ...


5

Considering that a comment_vote_counter and a blog_vote_counter are both a specialisation of a more general vote_coutner, makes this a common ORM design issue. In fact you have the choice: The first option is called single table inheritance, because you squeeze several different kind of counters in the same table that provides for all the needed attributes....


1

Per the question, the operation has two parts: Determining if a record for a value exists. Returning the record if the value exists. Part 1: Existence Per the question: There are 100 billion possible values 1 billion of those values actually exist. Since these are integers and computers typically come in 32 bit and 64 bit flavors, they must be 64 bit ...


1

I'll start off by saying I think the RDBMS can do this as well if not better than a custom solution but here are some ways you can do this. Bloom Filter The problem that a Bloom filter is designed to help solve is exactly the one you are working on: determining whether a number is part of a set. A bloom filter doesn't tell you for sure that a number is part ...


1

Scan through both lists in lockstep Given two sorted lists, you can find their intersection by scanning through the lists, increasing the index of the lesser item. It looks something like this: var i = 0, j = 0; var intersection = []; while (i < a.length && j < b.length) { if (a[i] == b[j]) { intersection.push(a[i]); i += ...


2

Is it a standard practice to have only one application writing in the database? Not at all. A database is in general used to store, share and integrate information between many applications. This is not to be confused with the very special situation of microservices, where often a database may be used exclusively by one service. Is it a standard practice ...


0

Binary search on an ordinary data file If the only data that you need to store are the integers themselves, then you could simply store them as 64 bit integers in a data file, sorted in ascending order. Then with a binary search of at most 30 comparisons, you can find whether any integer is in your data set.


0

Divide and conquer. Spread the billion integers across buckets based on what range they fall into, and store them in key-value format with key = bucket number and value = integers that fall in that range. Say each bucket covers a range of one million integers (you can adjust this based on your needs). Then you will have 100,000 buckets: Bucket 1 = 1 - 1,...


1

Partitionning is a distribution model based for data: vertical partitioning splits different kind of data (e.g. tables or columns) between different nodes, independently of data values. horizontal partitioning splits the same kind of data (e.g. rows) between different nodes, based on the data values. Sharding is in principle a horizontal partitioning ...


0

I am not sure if the websocket server and REST API should be separate running? Server-Sent Events (SSE) or WebSocket both share the same characteristic: the HTTPS connection remains open for a long time. In an ordinary API, if you have 500 clients, it means that you may have maybe 5 concurrent connections, maybe 50, depending on how fast the responses are ...


4

The thing is I'm using EF Core to connect to de database, so I'm pretty attached to SQL Server. No, you are not. EF Core contains a bunch of providers, including Sqlite, PostgreSQL, and MySql. Googling for specific databases gives you more information about the ability to use them with EF Core.


1

The usual requirements for using a DBMS in automated testing are isolated testing by different developers, each one with their local db individual, stable test data for each test easy to maintain test data easy to maintain data for the expected outcome of a test, especially in case the system evolves and the data has to adapted to changed requirements test ...


1

The answer given by Doc Brown shows some good ways to deal with this in your ETL process, but I would question the assumption that getting the vendors to correct their typos is not feasible. What about typos in names? If the vendor uses "The Baginnings" for a women's handbag, how would you know whether that's a typo or a wordplay? What about prices or item ...


3

The solution to this is quite simple: once you identified the typos manually, automate the correction in some program or script and make it part of the "Transform" step in your ETL pipeline. Think of what you would do manually: lets say you have learned the collection field can contain names of seasons like Summer, Winter, Autumn, Spring, and you have seen ...


0

References are wonderful things. If you really need something to be an object, and to be available in two locations, then consider passing references to that one object to those two locations. Do this an you don’t have to search though a list to find it because you never lose it. You keep track of it somewhere else as well. At first people feel ...


Top 50 recent answers are included