Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
79 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 ...
0
votes
2answers
38 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 ...
0
votes
1answer
117 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
0answers
12 views

General structures / algorithms for parsing / interpreting a semantic query efficiently

If you have a semantic/meaning graph data structure built up, and you get a new word as part of a sentence, the question is, how it optimally determines the meaning of that new word. It seems that, ...
0
votes
0answers
77 views

How to structure a bitwise trie to do a range query

I am wondering about how to perform a range query on a bitwise trie. So say I have a trie like this. ▲ Black (any shape) is 0. △ White (any shape) is 1. ■ Black square means there is no value ...
0
votes
2answers
130 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 ...
1
vote
2answers
100 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 ...
3
votes
3answers
627 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
1answer
54 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)...
2
votes
4answers
269 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
2answers
142 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
2answers
98 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
2answers
93 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 ...
-5
votes
2answers
142 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 ...
2
votes
2answers
5k 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....
0
votes
1answer
551 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 ...
2
votes
1answer
2k 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
3answers
235 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
2answers
63 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
1answer
156 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 -...
3
votes
1answer
435 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 ...
4
votes
1answer
231 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 ...
4
votes
1answer
449 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
2answers
189 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
1answer
83 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
3answers
159 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
2answers
609 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
0answers
89 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
2answers
894 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 ...
4
votes
1answer
151 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
1answer
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
1answer
225 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
4answers
483 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
1answer
56 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
2answers
274 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
1answer
781 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
1answer
166 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
1answer
292 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 ...
12
votes
2answers
20k 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. ...
3
votes
3answers
5k views

What is selection and what is projection

I am working on Android with the query() method of the ContentResolver class and it accepts 6 parameters, (uri,projection,selection,selectionArgs,sortOrder,cancellationSignal) for selection and ...
0
votes
1answer
1k views

Dynamic query in MySQL

I'm doing a J2EE web application with Struts2, MyBatis and a MySQL database, so what I want is to allow the user to be free to choose different parameters to perform a select to a table in the ...
3
votes
1answer
501 views

End user query syntax?

I'm making a command line tool that allows end users to query a statically-schemed database; however, I want users to be able to specify boolean matchers in their query (effectively things like "get ...
0
votes
2answers
78 views

Trying to “combine” similar objects without doing a bazillion comparisons

In this database I have "accesses" - each access can have any number (usually less than 4, sometimes as many as 15) attributes. I also have "tickets" where N users are requesting M accesses, so I've ...
1
vote
2answers
781 views

Examples of designing a database that handles point tracking?

I'm attempting to expand my knowledge of how database designs and concepts work. I'm working on a hobby web/mobile app for practice that will challenge me. However, I am running into an issue. What ...
0
votes
0answers
92 views

Search technique - multiple hits, prioritise results

I have developed a search algorithm, which basically matches records on 3 different criteria types. Name, Address, and Keyword(s). "doh" , will find: Name: doh Address: re Keywords: me Name: re ...
2
votes
2answers
502 views

Use Of Exists clause in SQL

Just finished Stanford lecture on SQL (by Prof. Jennifer Widom). However I have developed a confusion regarding the use of EXISTS clause. I thought it is just like a condition and an expression so ...
2
votes
1answer
253 views

Mental schema for SQL queries [closed]

While preparing SQL introductory material, I've ended asking myself about the line of thought followed by a developer when writing a query. I believe it could be too valuable from a beginner's point ...
0
votes
2answers
299 views

raw aql query in framework with Active Record pattern based ORM

I use yii framework that implements Active Record pattern as ORM base. It has CActiveRecord class that is a table wrapper class with attributes reflecting table columns. So each object of this class ...
0
votes
3answers
753 views

Designing a SQL-like encapsulation object for programmatic use

In the last few weeks, I have been working on a Data Mapping Library, which has involved lots of research, experimentation, crying, blaming the whiteboard for not being big enough, and more research. ...
5
votes
1answer
69 views

How to model and query spatial responsibilites of company local branches

what are best practices, to model and query spatial responsibilities of company local branches? My company has many local branches which are all in general responsible for 1 city. This is the easiest ...