SQL query plan question
- From: Chris <spam_me_not@xxxxxxxxxx>
- Date: Fri, 14 Jul 2006 12:06:57 -0500
Suppose we have a very large table in a SQL database, and want to execute this query:
select *
from table
where price > 10.00
order by name
Assume that both price and name are high-cardinality columns, that is, there is a very large number of unique values in each column.
Suppose that we have an index on price, and an index on name, but we do *not* have an index on price + name.
Is there any query plan that can evaluate this query efficiently? I'm not seeing one, but I really hope that there is. From what I see, if we start by traversing the name index, we'll have to do a full table scan. If we traverse the price index, then we'll have to accumulate all the names and do a brute-force sort.
Here's one other little twist: we do not have to return the entire result set, only the first 10 records.
.
- Prev by Date: Re: Mapping rationals to binary strings while preserving order
- Next by Date: Re: Mapping rationals to binary strings while preserving order
- Previous by thread: Fixed point properties of oracle Turing machines
- Next by thread: Why LL(1) Parsers do not support left recursion?
- Index(es):
Relevant Pages
|