Questions tagged [mysql]

MySQL is an open-source, relational database management system.

Filter by
Sorted by
Tagged with
244 votes
13 answers

Is it a bad practice to store large files (10 MB) in a database?

I am currently creating a web application that allows users to store and share files, 1 MB - 10 MB in size. It seems to me that storing the files in a database will significantly slow down ...
B Seven's user avatar
  • 3,125
241 votes
13 answers

Why use a database instead of just saving your data to disk?

Instead of a database I just serialize my data to JSON, saving and loading it to disk when necessary. All the data management is made on the program itself, which is faster AND easier than using SQL ...
MaiaVictor's user avatar
  • 5,830
173 votes
21 answers

Stored Procedures a bad practice at one of worlds largest IT software consulting firms?

I'm working at a project in one of the world's top 3 IT consulting firms, and was told by a DBA that company best practice's state stored procedures are not a "best practice". This is so contrary to ...
172 votes
3 answers

Benefits of Structured Logging vs basic logging

We're building a new app and I'd like to include structured logging. My ideal setup would be something like Serilog for our C# code, and Bunyan for our JS. These would feed into fluentd and then could ...
DTI-Matt's user avatar
  • 1,829
103 votes
3 answers

What's the difference between MariaDB and MySQL?

What's the difference between MariaDB and MySQL? I'm not very familiar with both. I'm primarily a front end developer for the most part. Are they syntactically similar? Where do these two query ...
chrisjlee's user avatar
  • 2,070
101 votes
10 answers

Why is "Select * from table" considered bad practice

Yesterday I was discussing with a "hobby" programmer (I myself am a professional programmer). We came across some of his work, and he said he always queries all columns in his database (even on/in ...
the baconing's user avatar
  • 1,121
77 votes
15 answers

Why should passwords be encrypted if they are being stored in a secure database?

I have a web service. Right now, I have passwords stored in plain text in a MySQL table on my server. I know this isn't the best practice, and that is why I am working on it. Why should passwords be ...
phpmysqlguy's user avatar
69 votes
6 answers

Should Latin-1 be used over UTF-8 when it comes to database configuration?

We are using MySQL at the company I work for, and we build both client-facing and internal applications using Ruby on Rails. When I started working here, I ran into a problem what I had never ...
Ten Bitcomb's user avatar
  • 1,164
65 votes
5 answers

Is backing up a MySQL database in Git a good idea?

I am trying to improve the backup situation for my application. I have a Django application and MySQL database. I read an article suggesting backing up the database in Git. On the one hand I like it,...
wobbily_col's user avatar
  • 1,881
62 votes
11 answers

Should I define the relations between tables in the database or just in code?

In my experience, many of the projects I have read in the past didn't have relationship definitions in the database, instead they only defined them in the source code. So I'm wondering what are the ...
Yoshi's user avatar
  • 757
56 votes
4 answers

Why is using MySQL for a dictionary website a bad idea?

I'm planning to design and set up a database to store dictionary entries (usually single words) and their meaning in another language. So, for example, the table Glossary must have entry and ...
Aziz Az's user avatar
  • 491
50 votes
3 answers

What is the difference between btree and rtree indexing?

I've noticed on MySQLWorkbench that you can choose how to store your indexes before forward engineering your design. The storage types are: BTREE RTREE HASH Researching this, I found some ...
user avatar
47 votes
2 answers

Data Synchronization in mobile apps - multiple devices, multiple users

I'm looking into building my first mobile app. One of the core features of the application is that multiple devices/users will have access to the same data -- and all of them will have CRUD rights. I ...
ProgrammerNewbie's user avatar
41 votes
3 answers

Is there any reason to use varchar over text columns in a database?

Is varchar just a remnant from before text came around, or are there use cases where you would want to use a varchar? (Or char for that matter..) (I use Postgres and MySQL (MyISAM) daily, so those ...
Izkata's user avatar
  • 6,098
38 votes
11 answers

Why isn't protection against SQL injection a high priority?

On Stack Overflow, I see a lot of PHP code in questions and answers that have MySQL queries that are highly vulnerable to SQL injection attacks, despite basic workarounds being widely available for ...
Lightness Races in Orbit's user avatar
34 votes
3 answers

How to build completely modular web applications [closed]

In the coming months we're going to begin a project where we take a system we've built for a client (v1) and rebuild it from scratch. Our goal with v2 is to make it modular, so that this specific ...
Ben's user avatar
  • 625
29 votes
2 answers

What is the difference between collation and character set?

I have a general question about databases. We usually use the term collation with databases. I would like to know how its different from character set. I guess collation is a subset of character set. ...
Shameer's user avatar
  • 443
25 votes
3 answers

Datetime vs Timestamp in MySQL and PHP in practice?

I am not sure how to specify my datatype as datetime or timestamp, I think I will need both of them but on the different events. My website sells products and services worldwide and also have an ...
Modular's user avatar
  • 353
23 votes
7 answers

Is saving SQL statements in a table for executing later a bad idea?

Is saving SQL statements in a MySQL table for executing later a bad idea? The SQL statements will be ready for execution, i.e. there will be no parameters to swap or anything, for example DELETE FROM ...
Amged Rustom's user avatar
23 votes
4 answers

Store images in the database, or in files with a database link?

Is it appropriate to store the image files in the database? Or it would be better to store only the path of the file in the database, while keeping the file itself on the server? Are there any other ...
LostMohican's user avatar
22 votes
7 answers

Should I encrypt data in database?

I have a client, for which I'm going to do an Web application about patient care, managing patients, consults, history, calendars, everything about that basically. The problem is that this is ...
Tio's user avatar
  • 481
21 votes
6 answers

Pitfalls of using MySQL as your database choice? [closed]

I've read online on multiple occassions that MySQL is a bad database. The places I've read this include some threads on Reddit, but they never seem to delve in on why it's a poor product. Is there ...
user avatar
20 votes
10 answers

Struggling as a programmer. Need some advice [closed]

I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done". But, there is a difference between "getting the job done" and "doing the job properly". Let's ...
James Guvna Jeffery's user avatar
20 votes
5 answers

When should a database table use timestamps?

First a note, I thought maybe this question belonged in the database exchange, but I think it is more broadly related to a programming solution as a whole than to databases. Will move to database ...
GWed's user avatar
  • 3,125
19 votes
2 answers

How to get real time notifications, when a database change (insert, update, delete) occurs?

I'm creating a dashboard which should monitor a database table. I have only database access (no application layer). The table is rather large (10 million rows), however not changing rapidly (100 ...
Kiril's user avatar
  • 529
18 votes
1 answer

Is it possible/advisable to combine unit testing and integration testing?

I've built a Python script that consists of about 20 functions that extract data from MySQL via .sql files (I'm currently trying to learn SQLAlchemy ORM), do something to it and then put it back in ...
Jossy's user avatar
  • 311
18 votes
7 answers

Best practices to follow with database indexes [closed]

What are some DOs and DONTs for improving database performance using index? A DO would be a case in which an index should be created, or another indexes related tip that will improve performance. A ...
Click Upvote's user avatar
  • 2,707
18 votes
7 answers

500 databases or 1 database with 500 tables or just 1 table with all the records? [duplicate]

I currently have an application that is used by a single end customer. For ease of discussion assume the application only needs a single database table for all records. I now need to support multi-...
Phil Wright's user avatar
18 votes
3 answers

How to design website workflow?

I have been thinking about this for really long time without reaching an optimum answer. First of all, I'm a medical doctor who loves programming but never really studied it, except for home learning ...
Zalaboza's user avatar
  • 411
16 votes
3 answers

How to handle monetary values in PHP and MySql?

I've inherited a huge pile of legacy code written in PHP on top of a MySQL database. The thing I noticed is that the application uses doubles for storage and manipulation of data. Now I came across ...
Songo's user avatar
  • 6,588
15 votes
6 answers

Should I use DATE or VARCHAR in storing dates in MySQL?

Simply put, I have date and time attributes on an Orders table. The data types for these attributes are MySQL's DATE attribute. But everytime I echo the date and time in PHP it just gives me a string, ...
mizstereo's user avatar
  • 215
15 votes
9 answers

Can it be acceptable to construct SQL queries dynamically?

I know that as a general rule, you shouldn't construct SQL queries dynamically because of the possibility of SQL injection. However, it could come in quite handy to break this rule and define for ...
Thomas's user avatar
  • 185
15 votes
3 answers

How to design highly scalable web services in Java?

I am creating some Web Services that would have 2000 concurrent users. The services are offered for free and are hence expected to get a large user base. In the future it may be required to scale up ...
Kshitiz Sharma's user avatar
13 votes
4 answers

How to really master MySQL?

I have been using mysql for the same amount of time I have been using PHP. However I feel about 10x more confident in PHP; or any other programming language. But I just can't seem to really really ...
JD Isaacks's user avatar
  • 8,926
13 votes
3 answers

When to use a nosql database such as mongodb over mysql?

I'm new to the concept of nosql databases and have never used it. Based on what I've read and the little that I've understood I still don't see how they can be particularly useful if you can't make ...
akomada's user avatar
  • 131
13 votes
4 answers

What to do when your company doesn't encrypt passwords

Background I'm been contracted to help a company maintain their server. I work on some minor PHP projects but also look over performance issues and recently, scan logs for hackers. These guys have ...
bafromca's user avatar
  • 241
12 votes
9 answers

Is there a large bank using Mysql or PostgreSQL? [closed]

I always thought the largest scale of banks use Oracle. However, there is no proof they really use Oracle instead of Mysql or PostgreSQL, nobody knows the secret. Any idea what they really use? Can ...
YumYumYum's user avatar
  • 377
12 votes
5 answers

When is it better to offload work to the RDBMS rather than to do it in code?

Okay, I'll cop to it: I'm a better coder than I am at databases, and I'm wondering where thoughts on "best practices" lie on the subject of doing "simple" calculations in the SQL query vs. in the code,...
GeminiDomino's user avatar
12 votes
2 answers

Creating a separate table for images or adding "image fields" to many tables?

I need to create a database in which several tables have images. For example, users have profile pictures and uploaded ones and products have many pictures, as well. Is it better to have one SQL table ...
Computer's Guy's user avatar
12 votes
5 answers

What Do I Need To Know About Servers In a Web Development Role? [closed]

I know that may sound a little vague, so I'll try and explain a little further... After being self employed developer for many years I'm now in search of a commercial web developer role. My only ...
john's user avatar
  • 289
12 votes
3 answers

Patterns for Versioning Relational Data in a MySQL database?

I am trying to find an approach for a project, where A user can edit records, and be able to see past versions of those records. Here is a simlified example schema, using a list: TABLE list ( id ...
GSto's user avatar
  • 8,521
12 votes
1 answer

Social network notification system

Background I am working on an app for a client that includes some social networking features. I was originally developing the mobile front-end, but circumstances have left me in charge of developing ...
user45623's user avatar
  • 398
12 votes
2 answers

How to temporarily save the result of the query, to use in another?

I have this problem I think you may help me with. P.S. I'm not sure how to call this, so if anyone finds a more appropriate title, please do edit. Background I'm making this application for searching ...
Madara's Ghost's user avatar
11 votes
2 answers

Is a blob more efficient than a varchar for data that can be ANY size?

When setting up a database I want to use the most efficient data type for potentially fairly long data. Currently my project is to store song titles and thoughts pertaining to that song. Some titles ...
BillyNair's user avatar
  • 259
11 votes
1 answer

Algorithm to generate Edges and Vertexes outwards from origin with max multiplicity of 3

I am creating a 2d game for a website where the universe can grow extremely large (basically infinitely large). Initially, the universe is composed of 6 stars that are an equal distance from the ...
John F.'s user avatar
  • 111
10 votes
7 answers

When to start thinking about scalability? [closed]

I'm having a funny but also terrible problem. I'm about to launch a new (iPhone) app. It's a turn-based multiplayer game running on my own custom backend. But I'm afraid to launch. For some reason, I ...
Rits's user avatar
  • 211
10 votes
7 answers

What is the best approach for database design with lots of columns?

I am writing a query based financial application. It lets the user to write complicated equations (much like WHERE part of an SQL query) and find companies matching those criteria. For the above, I ...
Pratyush's user avatar
  • 203
10 votes
4 answers

Are there any conceptual drawbacks to building a web app with C++ and MySQL?

I've inherited a pretty interesting project where there is a good opportunity to take an existing piece of software and turn it into a SaaS web app. As the project is inherited, the code base/ ...
jnthnclrk's user avatar
  • 219
10 votes
6 answers

Is MongoDB the right choice in my case? [closed]

I'm going to build my first real project in Rails that consist in a web app made of 3 main parts: The static part where no database is used The User registration part which will require a database ...
Matteo Pagliazzi's user avatar
10 votes
4 answers

What is the main difference between HAS_MANY and BELONGS TO relationship in mysql?

After making little progress in web development and php I figured out if I can make my grip strong on database designing, I will be able to reduce much code and time in developing the application. But ...
Umair Abid's user avatar

2 3 4 5