Re: A never-ending query (almost)
Posted in 1995
Sally Woolrich <Sally@excelsis.demon.co.uk> writes:
>In article <46jkpg$49l@xmission.xmission.com>
> dirk@xmission.xmission.com "Derrek Poulson" writes:
><snip>
>> A query of the form:
>>
>> select * from table where field1="xxx">>
>> comes back within a second or so. A query like:
>>
>> select * from table where field1="xxx" and field2="yyy">>
>> takes between <1 second to over an hour (!),
>> depending on the value of field1.
>>
>The answers about checking the distribution of 'field1' and running
>'UPDATE STATISTICS' look useful, but you don't mention if there is
>any 'order by' clause.
Yes, they were good thoughts, but the distribution of field1 is reasonable
(200-300 rows per field1 value), and statistics are apparently not the
problem as SET EXPLAIN shows an index path on both queries.
There is no order by. Again, indexes are being used correctly.
>If this is the problem 'set explain on' will show it clearly.
>Fragmentation?
Checked this too. Only 4 extents...
>--
>============================================================================
>Sally Woolrich | This mail contains my personal
>sally@excelsis.demon.co.uk | views not those of my employer!
>============================================================================
--
---
- Derrek (dirk@xmission.com)