Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I understand you correctly, you want to be able to create a query that could have criteria based on any number of fields, which are unknown upfront. That's tough....</p> <p>While most RDBMS do offer some kind of "dynamic SQL" capability, those approachs tend to be either cumbersome to use, or slow, or both. </p> <p>Of course, you could also concatenate together a SQL statement in your client code, be it C#, Java, PHP or whatever - but that again will tend to be cumbersome, prone to SQL injection attacks, and in general rather clumsy.</p> <p>Also, if you have queries that are different from one request to another, the RDBMS won't be able to cache any of your query plans, and getting indexing right to get a decent query performance will be challenging at best, impossible at worst.</p> <p>So while I totally understand the requirement (and have to fight it off myself almost daily), it's really something that doesn't work well. I would rather try to identify the most frequently used searches and their criteria and make sure those work fine and are fast. Limit the user's flexibility in order to achieve a decent query performance. A classic trade-off - you can be totally flexible but then you have horrible performance, or you can make your frequent queries run fast - but loose some flexibility.</p> <p>One area where you could possibly gain something is when searching free text in text fields - RDBMS like SQL Server support the concept of a fulltext search, which gives you some flexibility and good performance. Check into that if you have lots of text fields.</p> <p>Marc</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload