197
votes
Benefits of Structured Logging vs basic logging
There are two fundamental advances with the structured approach that can't be emulated using text logs without (sometimes extreme levels of) additional effort.
Event Types
When you write two events ...
136
votes
Accepted
Should Latin-1 be used over UTF-8 when it comes to database configuration?
Unicode is certainly difficult, and the UTF-8 encoding has a couple of inconvenient properties. However, UTF-8 has become the de-facto standard encoding on the web, surpassing ASCII, Latin-1, UCS-2 ...
119
votes
Should I define the relations between tables in the database or just in code?
The database doesn't have to check for data integrity every time application modify data.
This is a deeply misguided point. Databases were created for precisely this purpose. If you need data ...
104
votes
Accepted
Is backing up a MySQL database in Git a good idea?
Before you lose any data, let me try to introduce a sysadmin perspective to this question.
There is only one reason we create backups: to make it possible to restore when something goes wrong, as it ...
94
votes
Accepted
Why is using MySQL for a dictionary website a bad idea?
I can't tell you why it's a bad idea. I can tell you a bunch of reasons why a relational database is a good idea though.
Remember that not everyone consults a dictionary for a definition. More times ...
71
votes
Accepted
Should I define the relations between tables in the database or just in code?
TL;DR: Relationship constraints should go in the database.
Your application ain't big enough.
You are correct, indeed, that enforcing relationships across databases may require enforcing them in the ...
64
votes
Should Latin-1 be used over UTF-8 when it comes to database configuration?
I think beyond the technical question, your boss may not have the time to keep up to date on current standards.
Since his stance is not completely out to lunch, just out-dated, respect his position ...
62
votes
Should I use DATE or VARCHAR in storing dates in MySQL?
I don't understand as to why the DATE data type exists
Always store Date values in Date Fields.
What PHP gives you back when you retrieve those values is a Character Representation of the Date value ...
52
votes
Should I define the relations between tables in the database or just in code?
The constraints should lie within your database, as (with the best will in the world), your application will not be the only thing to ever access this database.
At some point, there may need to be a ...
49
votes
Should Latin-1 be used over UTF-8 when it comes to database configuration?
Which of us is right?
Once upon a time, your boss was. But as time goes by, things change. Nowadays, you are (but before running to your boss, be sure to read Nelson's answer too).
Old versions of ...
44
votes
Accepted
Is it possible/advisable to combine unit testing and integration testing?
Is it possible/advisable to combine unit testing and integration testing?
Doing both unit testing and integration testing? Overwhelmingly yes.
Mashing them together in a single test suite? Not ...
39
votes
Is backing up a MySQL database in Git a good idea?
My two cents: I do not think it is a good idea. GIT does something like "storing snapshots of a set of files at different points in time", so you can perfectly use GIT for something like that, but ...
30
votes
How to not let anyone inspect elements of a webpage?
Never expose direct access to your database from the web layer. You can never lock that down; someone will send "DROP TABLE table" to your server, however much you lock down the JS source.
All they ...
27
votes
Why is using MySQL for a dictionary website a bad idea?
If you go with the key-value store (which offers you a more impoverished programming model) and it turns out you need more structure (in your case, say, adding a third language), or you need to do ...
24
votes
Should I use DATE or VARCHAR in storing dates in MySQL?
In programming, we are always working with abstractions and representations:
The text string 2021-02-09 12:47:14 UTC is a representation of a particular point in time.
The integer 1612874834 is a ...
21
votes
When to use a nosql database such as mongodb over mysql?
General Uses
If you have data structures that are not clearly defined at the time when you make the system. I tend to keep user settings in nosql, for example. Another example was a system where the ...
17
votes
Benefits of Structured Logging vs basic logging
When you are collecting logs for processing, be it for parsing into some database and/or searching through the processed logs later, using structured logging makes some of the processing easier/more ...
17
votes
Should I define the relations between tables in the database or just in code?
You should have relations in the database.
As the other answer notes, performance of constraint checking will be far better inside that database than inside your application. Database constraint ...
15
votes
Accepted
500 databases or 1 database with 500 tables or just 1 table with all the records?
Personally, I'd go with option 3 because:
It is normalized and simple
Easy to query for reports
Easy to back up(just 1 database to worry about)
If you index the table well, performance shouldn't be ...
14
votes
Accepted
Architecture for a mobile (Android) chat application
Some considerations:
Choice of database: relational databases such as Mysql or Postgres are not necessarily harder to scale than MongoDB and such. In many cases it's quite the opposite. Here is a ...
13
votes
Should I define the relations between tables in the database or just in code?
We no longer live in one back-end <-> one front-end world.
Most solutions involve a web front-end, a mobile front-end, a batch-front-end, and iPad front-end, etc.
Database engines already have ...
13
votes
Should I use DATE or VARCHAR in storing dates in MySQL?
But everytime I echo the date and time in PHP it just gives me a string, not a date object.
That's basically just the quirk of your DB access library. When it comes down to it, all data are reducible ...
12
votes
Accepted
Is indexing foreign keys a good practice?
Most, if not all, RDBMS automatically create an index on a FK because a FK means you will be doing joins using those columns.
It's standard RDBMS behavior based on the fact that you will be using ...
12
votes
Is it safe to put SQL statements in my C# application?
The "we don't have the resources" line is a red flag to me.
You're either going to pay to do it right, or you'll have to pay for doing it wrong. I know which I'd pick.
While your use case is ...
11
votes
Accepted
How to test data based on SQL queries?
Been there, done that.
First let's make something clear:
That's not unit testing. Unit testing is about code. You are not runnning the tests after a code change to test if code alterations ...
11
votes
Should I use DATE or VARCHAR in storing dates in MySQL?
Size
A MySQL DATE is 3 bytes. Each char is a VARCHAR is 1 byte. Which means your VARCHAR date is at least 2.67 times the size of a DATE. 3.33 if you include separators. Or much larger if your ...
10
votes
Accepted
Social network notification system
So if a thousand people are following Sally, we insert a thousand rows into the corresponding table. Is that scalable?
Yes, provided the database tables are properly indexed.
What happens if we get ...
10
votes
Do common relational database systems work 'out of the box'?
They do work out of the box, for the most part, but you do have to know how to use them. They don't come pre-populated with your application's data model, because they don't know what that is, so ...
10
votes
Why does databases use text?
You are mixing serialize with compress. Can use XML serialzation to store a form or class.
You can compress text and store it in a binary. You might get all of 7:1 compression. For that compression ...
10
votes
Benefits of Structured Logging vs basic logging
You won't find much benefit from structured logging when your app creates a few hundred log messages per day. You definitely will when you have a few hundred log messages per second coming from many ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mysql × 515php × 198
database × 137
database-design × 90
sql × 47
java × 28
relational-database × 27
design × 23
sql-server × 18
design-patterns × 16
nosql × 16
scalability × 13
c# × 12
performance × 12
mongodb × 12
object-oriented × 11
postgres × 11
javascript × 10
web-development × 10
web-applications × 9
data-structures × 9
node.js × 9
synchronization × 9
laravel × 9
algorithms × 8