[Rt-devel] Question about Type column in table Tickets

Rolf Grossmann rg at progtech.net
Fri Jul 1 13:51:57 EDT 2005


Andrew Sullivan wrote:

> On Fri, Jun 24, 2005 at 02:12:56PM +0200, Rolf Grossmann wrote:
> 
>>that. IMHO it's a serious flaw in Oracle's query optimizer that adding a 
>>condition that's always true significantly slows down a query.
> 
> Well, it still has to visit every row.  There's no way to know in
> advance that the condition is _always_ true, because the optimiser is
> cost-based (and therefore can only use statistics for this).  It's
> possible that the planning step would take a different strategy
> (using an index, say); but it'd still have to visit every row, and
> using an index in that case would be even more expensive.

The point is, it doesn't need to use the condition on all records, only 
those that match the other conditions. Also, for most searches (matching 
text in some field like in the given query) the database needs to look 
at every row anyway.

> The simple problem is that the condition isn't a selective one, and this
> suggests to me that the query is a bad one, given the structure.  (My
> experience overall with RT is that the automatic generation of SQL
> causes all sorts of poorly-written queries like this, that generate
> needless conditions that slow everything down).

Like Jesse and I said before, the condition is not needless.

Rolf


More information about the Rt-devel mailing list