1

A doc about MySQL Cluster says:

Many new applications need the back-end database to meet the above challenges, while still:

  • Preserving transactional integrity with ACID compliance;
  • Enabling deep insight by running complex, ad-hoc queries against the data;
  • Leveraging the proven benefits of industry standards and skill sets to reduce cost, risk and complexity.

So, what is the "ad-hoc query" ?

lovespring
  • 19,051
  • 42
  • 103
  • 153

2 Answers2

3

Databases are used in various ways. Often, they are the back ends of applications. In this case, the database can be optimized for a specific set of queries.

Ad hoc queries are queries that are unknown at the time the database is being designed -- simply because there are too many possibilities on how the database will work. So, the database cannot be optimized for them. These queries can become quite complicated.

Typically they would be used for two reasons. One is for analysis of the data -- to answer various questions that arise about the business. The second is for developing new application, during the development phase.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
3

This is a formatted comment.

In my world there are canned queries and ad hoc queries. The canned queries are already written and are available to run over and over again. They might be part of a web application or they might be part of a scheduled job. They may or may not take input parameters and they may or may not involve dynamic sql. They might be stored procedures or they might be part of application code. The key is that they are already written.

From time to time somebody will ask me to tell them what they want to know. Once I figure out the question, I write the query (or queries) and give them what they requested. Those are ad hoc queries.

Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43