Questions tagged [mysql]
MySQL is an open-source, relational database management system.
521
questions
2
votes
2
answers
157
views
Do we have 2 logical query processings, one with indexes and one without indexes?
In the book "Inside Microsoft® SQL Server® 2008: T-SQL Programming" the behaviour of a sql query is explained. The following picture is taken from the book. I have some questions about the ...
0
votes
2
answers
132
views
How to handle time differences in MySQL
I'm facing a problem with handling different timezones in MySQL. I have looked into similar questions that were previously raised, but I couldn't find a proper answer.
The issue I'm encountering is as ...
3
votes
3
answers
161
views
How to reliably determine changes in a DB table since some sort of "checkpoint"?
My scenario is fairly typical, but I can't figure out a good solution. I have a DB table (in reality several unrelated tables, but let's focus on one) where there is a fair deal of activity going on. ...
3
votes
2
answers
569
views
Is it a good practice to have two unique IDs for an SQL-Database?
Currently I want to create a SQL database effectively and "logically". Lately I read a lot about the issues that it is (mostly) not a good idea to define primary keys that can be seen from &...
15
votes
9
answers
8k
views
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 ...
1
vote
2
answers
304
views
Is it a good idea to design a database based on the API response data types?
I am trying to design my database, where i have to save some response data given from an external api as a webhook.
This api will return me as well “referenceId” as an identifier, which i will use ...
9
votes
4
answers
4k
views
How to store a fixed length array in a database
I have a mysql database in which I have drafts, each of which contains exactly 24 players the order of which matters. I am conflicted between having a drafts table with 24 extra columns for each ...
-2
votes
2
answers
112
views
How to filter and concatenate multiple sql files into one database [closed]
I have an issue where I have multiple databases from previous projects that I would like to combine into one large database. These databases are stored in .sql files. The issue is that I only need ...
-2
votes
2
answers
57
views
How to serve customized content to each user, based on targeting criteria?
In my PHP Laravel application, I want to display special offers to users, depending on the quality of their house(s).
There are 4 Models: User, House, Offer, OfferTargeting.
Each User can have many ...
1
vote
0
answers
99
views
Backend Design: System requires both ElasticSearch and MySQL. In which scenario we fetch data from MySQL or ElasticSearch?
So, one of the backend system, having 5 resource types (tables) and some foreign keys as well, requires full text support for two of the tables.
Also, for some use-cases, we require inner-joins for ...
1
vote
0
answers
339
views
Design MySQL database to store user workout data for Workout App
I am building a fitness app and I'm trying to figure out the optimal way to store the data is a MySQL database.
I would like to have specific programs (for example, 'get jacked'), I would like a users ...
-3
votes
1
answer
55
views
Server performance and CMS scalability [closed]
I have been given the job of a colleague who has resigned and I don't know where to start. I hope you can give me some hints:
It is about a CMS made from scratch (Javascript/jQuery/PHP/MySQL) which ...
0
votes
2
answers
93
views
Transferring data from 1 web app into another offline
I have a web app that will be used locally on 2 different site. The program is a Vue web app made with node.js and express, using MySQL database. Due to limitation (no internet in site 1), there is no ...
-1
votes
1
answer
101
views
Commit instead of rollback? [closed]
Simple example (PSEUDO CODE):
for (int i = 0; i < 100; i++) {
START TRANSACTION;
SELECT id, name FROM employees WHERE id = i;
IF (someFunction(id)) {
ROLLBACK;
...
-2
votes
2
answers
186
views
Avoid redundant field using JSON type in MySQL [closed]
I have experienc with designing relational dbs but first time attempting to store JSON in a mysql table. I am using mysql 5.7.8 which has the ability to store json data type as a column.
When I create ...
-1
votes
1
answer
1k
views
Locking a DB table and waiting for writing/reading it from a web application
I'm working on a web application using Spring (Java and JPA + Hibernate) and I was wondering if there is a way of locking a MYSQL table and then when another web service (or even another thread from ...
2
votes
1
answer
1k
views
Implementing transactional entity lockouts with Spring and JPA
Spring Boot/Java 8/MySQL here.
I have a widgets table in my MySQL DB that is modeled by a JPA entity like so:
@Entity
@Table(name = "widgets")
@Data
public class Widget {
@Column(name = ...
-2
votes
2
answers
144
views
Database Structure for The Best Efficiency
I want a database table that can hold all of the group chat messages from all of the group chats.
The max amount of users per group chat would be 20.
The max amount of group chats per user would 25-...
0
votes
1
answer
73
views
Database schema for two different types of elements on map
I wrote a software for a customer that shows clients on a map (Google Maps).
I store the clients on a table on the MySQL database (table clients) and show them on the map using markers. Each clients ...
4
votes
5
answers
2k
views
How can you ensure order of execution in concurrent tasks?
Here is what I am specifically doing:
I have a thread-safe queue
One 'write' thread constantly writes to the queue with data that comes from another service
Multiple 'read' threads take from the ...
0
votes
1
answer
398
views
Database normalization for grade management system
I am working on a grade management system web app for a university and I came up with this database schema
How the app work:
In the user table I am going to keep all the users data and the ...
-4
votes
1
answer
309
views
Design a login system
I have a task of designing login system with the requirement below:
If the user login over three times, lock account for the first 5 minutes. The next failed 3 times login-in will lock the user ...
2
votes
3
answers
289
views
Is it best practice to always try to return a minimum number of rows from the database?
First-time poster so please be gentle :)
I have a rather large table in my database (MySQL in case it matters) that holds lat/lng values of certain points of interest around the world (table name: ...
0
votes
0
answers
122
views
Fill Docker Container from existing remote database
I do have n nodes managed by Kubernetes, all of them running several containers. A container may contain a database alongside with an application. As containers should be stateless, all data within ...
0
votes
1
answer
221
views
Variable WHERE clause while avoiding sql injection
I want the user to be able to provide a custom WHERE statement against a mysql-backed platform... do I need to worry about any possible SQL injection attacks notwithstanding invalid sql? See the ...
15
votes
6
answers
13k
views
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, ...
0
votes
0
answers
49
views
What is best approach to designing a local-to-cloud cloud-to-local Infrastructure?
I plan to have a cloud web application(CWA) and several local web application(LWA), let's assume 3 LWAs and 1 CWA. CWA === LWA.
This web application would consist of a database server, file storage ...
2
votes
0
answers
57
views
Scaling Order Management System for ecommerce
Tech Stack: I am using MySQL 8 with InnoDB engine. Application is built using Java with Spring & Hibernate. Database is hosted in AWS RDS and web apps in EC2.
I have two primary tables for ...
-2
votes
2
answers
316
views
What's better, using DB or Storage services to save videos?
I am creating a website that allows to teachers to uploading courses, what's better, to just use the DB or should I use storage services, and how could I know the size of the videos?
I am using AWS if ...
-1
votes
1
answer
711
views
Best practice to flatten JSON object and store it database
I'm fetching data from Clockify, flattening the JSON response, and storing it in the database where each property on the API response should have its own table's field.
I have read this article about ...
0
votes
1
answer
184
views
Does it make sense to have redundant DB fields to improve query performance, programming speed and code readability?
I am a bit torn about the database design for a solution. I have the following structure: (only the relevant fields are marked with #)
+------------------+
| activities |
|------------------|
| ...
0
votes
1
answer
568
views
Is deterministic SELECT possible without specifying an ORDER BY?
When we show a table with many thousands of records, we only show a small part of the total result set so as not to send too much data to the client at once. Clients can request more parts of the ...
0
votes
0
answers
92
views
DataBase Design for frequent delete operations
We have a use case wherein we want to store incoming data and invalidate all the previously existing data pertaining to one parent entity.
ie Parent p1 --> has List< child> old_data ( already ...
-3
votes
2
answers
163
views
Does DigitalOcean offer enough resources to run a scalable MySQL cluster?
I have a Kubernetes instance from DigitalOcean that has 2 worker nodes and 1 load balancer. Now I want to create a MySQL managed database cluster for the app that will run on that Kubernetes.
Question ...
0
votes
2
answers
110
views
How can you avoid doing hundreds/thousands of queries when utilizing classes in PHP?
I have been dipping my toes into object orientated PHP programming and I'm finding it useful but I can't help but feel I'm missing something in regards to how to utilize it.
Normally my classes and ...
-3
votes
2
answers
53
views
Does it make sense for a large scale SaaS project to use a single all powerful SQL/RDBMS database?
Scalability seems to be a thing now.
I was in a heated argument with one of my developer who insist on using MySQL for a data intensive application we are building. MySql is easy, fits the purpose and ...
1
vote
2
answers
155
views
Appropriate database schema
I'm currently collecting the data about flat prices. I have size, price, location, price per m2 and date of retrieving the data about flat(sample date). I'm plannig create MySQL database filled with ...
1
vote
0
answers
53
views
Best way to integrate google signin in existing user registration system with PHP/MYSQL [Logic]
I want to integrate google signin, in our existing user registration system. But not sure which approach will be good in terms of data security + user experience (UX) + speed. Even if its a good idea ...
18
votes
1
answer
6k
views
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 ...
0
votes
5
answers
854
views
Is it reliable to compress database backups with git?
I'm working as an intern at a fund. I spent the last month building a website for internal use, and now I think it's a good time to set up a backup scheme for the MySQL database at its backend. Funny ...
1
vote
0
answers
194
views
Should I decouple MySQL database?
I have two sites, one is a subdomain of the other. They both do different things entirely with one unifying goal.
My intent is to have the main site do a majority of the heavy lifting, and the ...
0
votes
1
answer
408
views
Database dictionary table versus code defined enum
For the following table structure, for the metric_id column, what are the advantages of having a JOIN dictionary table versus an ENUM dictionary defined in the code?
Assuming the metrics dictionary is ...
3
votes
2
answers
6k
views
Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise?
I'm developing a REST API using Nodejs along with MySQL as the database.Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise ? ...
0
votes
0
answers
47
views
Drag and drop and handling huge amount of documents to update position
I'm having a series of data as documents in a document db (CouchDB)
Sample of a document looks like below
{
_id: xxx
_rev: xxx
data: xxx
position: 1
}
These documents displays in a web front-end ...
0
votes
1
answer
171
views
Implementing a user ID system like Discords for a web app using Java Spring, JPA, Hibernate and MySQL
I’m trying to create a web application with a forum and user profile along with other functions. However I’m thinking about how I might implement an ID for each user. The best way I’ve seen other ...
-2
votes
3
answers
373
views
How should I store file history in a MySQl data?
I am creating a web app with JS and PHP where users can edit a file similar to a text editor such as notepad. I've decided to use a database to store these files. One of the primary functions of a ...
0
votes
0
answers
48
views
Architecture to check for user properties in bulk?
We run an infrastructure in our organization, where a list of configs are provided and we check which config a given user satisfies.
For eg:
config_1 = {"a": 1, "b": 2, "c": 3}
config_2 = {"a": 1, "b"...
0
votes
2
answers
393
views
Is it true that ORM allows for changing the type of SQL that you use easily?
Hey so I have been looking into ORM since my last question and I am wondering.
Instead of worrying alot right now about whether I will use mysql, postgre, or sqlite, would it be better to use ORM ...
-1
votes
1
answer
110
views
Best practices for creating structured data from "flat" SQL query results
Recently I've been working on a project to teach myself PHP and SQL, and as the project has gotten more complex I've been wondering what the idiomatic approaches are for creating the backend models ...
2
votes
2
answers
1k
views
Chat part of application - using UDP or TCP?
I'm trying to build a section of my app where two users can message each other. I've read about TCP and UDP and it seems like TCP is more suited due to ordered packet delivery. However, TCP requires a ...