Questions tagged [query]
Database and dataset queries, using existing query features with well identified criteria. If the criteria to find the data are unclear, the [search] tag is preferred.
74 questions
2
votes
3
answers
616
views
Dynamically transform EAV data into standard SQL table
I use MariaDB to store data using EAV model. I need EAV, because each attribute of each entity can have its own validity (validFrom, validTo).
For example, I have entity person and I track changes ...
0
votes
1
answer
328
views
How can I trace back the original table of a column?
New to a software engeneer job and I am kinda blocked on the way to go with my new project
To explain this in a scheme.
I have a source of data in a custom app that is for most part of the time the ...
1
vote
1
answer
129
views
What's the difference between MongoDB Query API and MondoDB Query Language?
So I've been trying to understand the difference between MongoDB's Query API and its Query Language but I haven't been able to find a definitive answer.
I've been reading the MongoDB Docs and it is ...
1
vote
2
answers
214
views
Minimizing queries on a database
I am working with a large dataset (~5GB) stored in a Google BigQuery database. My goal is to create a web app which works a little bit like an Excel spreadsheet where users start off by seeing the ...
2
votes
3
answers
3k
views
Where should "query" business logic be placed in Domain-driven design?
System description
This is a simple eCommerce application containing a Products inventory managed by an Admin. The Products in inventory/repository will show in the User App. Admin has the ability to ...
0
votes
1
answer
228
views
Why is there just one HAVING in SQL?
In SQL there is WHERE and HAVING: ... WHERE ... GROUP BY ... HAVING ....
Why isn't there multiple GROUP BY and multiple HAVINGs per SELECT statement like: ... WHERE ... GROUP BY ... HAVING ... GROUP ...
-4
votes
1
answer
249
views
Is it better (from a maintenance perspective) to dynamically construct complex SQL queries using Jinja or String concatenation? [closed]
Two possibilities. Which is better, with respect to readability, maintenance and clean code:
SQL injection can be disregarded.
Constructing complex parameterized sql queries using python string ...
2
votes
0
answers
172
views
Data Types Based Database
I was wandering if there exists some kind of database that organises data based on some declared type rather than tables or collections.
I'll try to explain better with an example.
Let's say I have ...
0
votes
2
answers
241
views
Is all permutations of a string a good way to index full text search?
I am writing an application to be used as a local disc documents store similar functionality to Firebase or MongoDB. The gist of how it works is a column hash table.
For example:
Say I have a user ...
2
votes
0
answers
357
views
Use model instance to access model's manager 'objects'
In the Django documentation it's mentioned that Django managers are accessible only via model classes rather than model instances to enforce table and record level operations. What are table and ...
1
vote
8
answers
930
views
Is there a way to prevent developers leaking data while they are developing?
I am working with a startup company for a while now. They have been affected by some reckless developers in the past. One area they want a real and immediate improvement is when they assign a task to ...
0
votes
0
answers
27
views
Efficiently querying for a set of objects for price comparison
I am designing a system where a user can input a budget and a query returns to them sets of objects that they can afford from different vendors. The system has 100s of different combination types (i.e ...
0
votes
1
answer
65
views
Horizontally Scalable Streaming of SQL Query Results
I have a service that runs queries on a database and gets (potentially) large number of rows. I also have services that can export a given set of rows to csv, xlsx or pdf etc. I have separate export ...
1
vote
1
answer
281
views
Private class in ORM Repository?
Is this a code smell?
I have a repository which connects to a SQL server. This repository uses Dapper to map the results to an object.
I have a method in this repository that checks a result, then ...
-1
votes
2
answers
329
views
How do job queues return results to UI?
I am working on an app that will run queries and return results to UI. However, these queries can take a long time to finish so I should not wait for the result. As far as I know, people use task ...
1
vote
2
answers
2k
views
How fuzzy search is implemented for file paths
Say I have file paths like this:
my/long/directory/structure/index.js
my/long/directory/structure2/index.js
my/long/directory/structure3/index.js
my/long/directory/structure.../index.js
my/long/...
0
votes
2
answers
157
views
How to build reports for an ecommerce webapp without slowing it down
We have a medium sized ecommerce website which is entirely custom built in using Java and MySQL database on AWS infrastructure. Over a period of past several years, our orders volume has grown ...
2
votes
2
answers
438
views
Define a complex query in JSON sensibly
A bit of background. We are in the design phase of an HTTP API, and we are facing the question of how to define complex queries in JSON format. We have a items in our product that have A LOT of fields ...
8
votes
3
answers
7k
views
DB Queries in code or use Stored Procedures
Some of my colleagues tells me that using stored procedures in the database adds to much business logic in the database, and that you should keep the data separate from logic. Other colleagues tells ...
0
votes
1
answer
851
views
Limitations of Tries in Comparison to B-Trees for a Database
I am wondering about how range queries work, and the standard solution is to use B+trees. However, I am a fan of tries as a general data structure and would like to know if they (or variations of them)...
3
votes
4
answers
4k
views
Strategy to improve performance on key-value pairs table
The situation
Our system has a MySQL database with a product table whose parameters can't be modified.
In order to add optional extra parameters, a developer designed a key-value pair table which ...
0
votes
3
answers
210
views
Do i need 2 tables to book entity?
I am developing a website to store books info such (title, book_no, author, edition, container...). I have two types of insert
insert series of books (Eg: harry porter series: chapter 1, 2,3...)
...
2
votes
2
answers
158
views
What is the best practice for pairing objects of a sorted vector?
I have a vector that stores multiple instances of a type T:
std::vector<T> vec;
From time to time, vec is being sorted for different purposes. Now, I need a list of pairs of objects stored in ...
3
votes
2
answers
360
views
Designing a api with chain of queries
I am trying to write a rest GET api to serve query results. The entire flow happening on the server is:
Fetch user data
Call the first query, if results generated: return results, else continue
...
-6
votes
2
answers
259
views
It's safe to access to the database and querying from it directly if it's on the server side, if not what should i do? [closed]
I made WPF application for a client-side and hosting database in a server side ,
I know there is something called REST API to transfer data between a client and server
I don't know this method and ...
3
votes
2
answers
16k
views
Using Map to pass query parameters in DAO
It's very common see a generic's DAO implementation like this:
public List<E> getResultList(String namedQuery, Map<String, Object> parameters) {
Query query = entityManager....
3
votes
1
answer
2k
views
Best way to query immutable MySQL Data
I have been increasingly using immutable data storing for my web-app, due to some advantages it has (simpler writes, ability to view history / activity).
I am doing it using MySQL dabatases, simply ...
4
votes
1
answer
6k
views
How to query data from multiple microservices
I have micro service architecture application. One of the services contains all user related information. Another service contains a set of business objects. The Angular UI calls rest APIs of user-...
1
vote
3
answers
3k
views
Saving user searches to a database
My job is to come up with an implementation to save searches linked to an individual user, as well as the ability to analyze this data for business cases.
The data will be used for users to see their ...
1
vote
2
answers
89
views
When to use pagination from database with ajax request
Is there a "rule of thumb" to when it is right to take partial result from a table, rather than the whole table?
Consider my current dilemma:
SQL view that has total of ~1200 items, the view is not ...
1
vote
1
answer
185
views
What's a good robust way to query processes for their help or framework origin especially in Windows?
What's a good robust way to query processes for their help or framework origin, especially in Windows?
I've got an automated testing module that queries binaries that fit a special name pattern with -...
2
votes
1
answer
2k
views
Is it OK to use the Visitor pattern for queries?
On the net and in books you commonly see examples of the visitor pattern just using "commands" i.e. methods perform an action and have no return type.
Is it OK to use this pattern for a query ...
5
votes
2
answers
562
views
Preferred approach to a matching process
I am currently in the process of putting together a matching algorithm. The matching process is as follows:
Query data is used to perform a "lookup" on a set of reference data in order to determine ...
3
votes
1
answer
1k
views
What's an efficient data structure to make a lot of queries between parents/childs?
I have the following scenario for which I've been experiencing performance problems:
The context is a level editor of a new engine for an old video game (whose source is unavailable) in Unity. ...
2
votes
2
answers
1k
views
How to update a player's money count every second
I'm in the process of analysis for a browser-based game I'm making, and I have question about programming the economy system. I'll use a simplified system to ask my question.
Each user as GameState ...
1
vote
1
answer
229
views
Loading all DB entries each time vs loading only new ones (and how to identify them)
I have a JSF Page (Primefaces) with a datatable that contains entries from a Database. Thoes entries represent transactions created by users.
Each time this page is loaded, I do this:
Clear the ...
3
votes
3
answers
177
views
How should I query the DB for a specific key without querying every time the feature is called?
We have a large legacy Java-based project, the availability of certain features throughout the application is determined by its corresponding value in a "feature_enabled" table in a SQL database. Much ...
3
votes
2
answers
1k
views
In a CQRS/ES application, can projections be dependant?
With event sourcing, you can project an event to create query-optimised read models. This I understand. What I'm unsure about is whether these read models can depend on each other?
I'm considering ...
1
vote
0
answers
103
views
How to convince teammates to start separating database queries into one single layer
We are using ORM with bunch of database models and those ORM database queries (and models, of course) - are literally all over application from top to bottom.
And when change in model structure ...
1
vote
2
answers
3k
views
Reading the result of your command with the Command Pattern
I am currently looking into developing a new system utilizing hexagonal architecture and the commandpattern facilitated by a commandbus like tactician (it's a PHP system).
Now I really like the idea ...
3
votes
1
answer
294
views
Efficient Value-Lookup in List of k-Tuples
I've encountered a problem in a personal project that I think could be solved by a particular data structure but I'm not sure what. The problem is as follows:
Given a set of k-tuples, provide an ...
-2
votes
1
answer
1k
views
How to compare Sql datetime field with date field [closed]
I have datetime type column in sql tablename id createdand i get date from input date type html tag I want to compare in sql query where close condition. How to compare both field.
var startDate = $('...
1
vote
1
answer
593
views
Most efficient way to keep count of objects in State X without constantly counting
The application I work on manages hundreds of thousands of records each in a different state in their lifecycle. A large requirement is to have a nearly accurate count of these objects in each state ...
2
votes
5
answers
870
views
How does a query execution plan affect query execution?
I have read some articles on SQL Server query optimization. The point I get is SQL Server generates a query execution plan for each stored procedure when it's executed for the first time. Those ...
-1
votes
1
answer
63
views
Database multiple database query each time
I'm writing a rest service. For each request I use about 4-8 queries.
Should I try to refactor those into a single query?
3
votes
2
answers
307
views
Reducing a sequence of array modification operations (insert, sort, replace, remove)
Given a plain array of values, e.g.
["Apple", "Orange", "Banana", "Strawberry"]
and a list of operations from the set of [insert, delete, sort and replace], e.g.
[
{cmd: "insert", index: 2, ...
5
votes
1
answer
901
views
How to implement efficient heterogeneous microservice data queries?
Our team has an idea of implementing a simple declarative DSL that would let users query the enterprise's domain model via a single interface without caring which specific microservices to call to get ...
1
vote
1
answer
226
views
How would one allow a client to query a graph database in Smalltalk, without exposing all of Smalltalk? [closed]
Is there any example of Smalltalk being used as a query language?
What I am looking for is: a system or an application where the Smalltalk nature of the application is hidden or irrelevant to the end-...
2
votes
1
answer
322
views
Data model for persisting queries to database
I have been asked to build what is essentially a query builder for a reporting application.
The variety of objects to query, potential modifiers, number of conditions, and so forth to be reported on ...
22
votes
3
answers
35k
views
Why would I use ElasticSearch if I already use a graph database?
I don't find any deep explanation on the web about a comparison between ElasticSearch and the graph databases.
Both are optimized to traverse data.
ElasticSearch seems to be optimized for analytics.
...