|
Home > Archive > SQL Anywhere database > August 2005 > Could someone tell me why index is not working....
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Could someone tell me why index is not working....
|
|
| Karthik 2005-08-24, 8:24 pm |
| Hi All,
I have the following table called wo_employee and it has many
coulmns.
Out of that I created a index called paid_date_idx (paid_date).
When I query my database from this table as the following query.
Select Sum(check_amount) from wo_employee where paid_date >=
'2004/01/01' and paid_date <= '2004/12/31'
It is not using the index at all. It process sequentially in
order to sum the amount.
Could someone please tell me how to run this query using the
index. I am using ASA 8.0
I already tried forcing index, still no use. Please let me know
some hints
Thanks
Karthik
| |
| Greg Fenton 2005-08-25, 3:31 am |
| Karthik wrote:
>
> Could someone please tell me how to run this query using the
> index. I am using ASA 8.0
>
Please always post the version and build number of SQLAnywhere that you
are using (e.g. use the command "dbeng8 -v")
Why do you want to force the use of the index?
What tells you that a sequential scan isn't the most efficient plan?
Is the index used on subsequent calls or does each run of the query
doing a sequential scan?
Can you post the graphical plan with statistics for this query?
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Richard Biffl 2005-08-25, 3:31 am |
| A similar query here, on a similar table, uses the index on the date field.
I'm running ASA 8.0.3.5267. If you have an older version, you should update
to 8.0.3 and then to the latest EBF. If you still have the same problem, try
dropping and recreating the index.
Richard
"Karthik" <kpanc@laborfinders.com> wrote in message
news:430cbd2a@forums
-1-dub...
> Hi All,
>
> I have the following table called wo_employee and it has many
> coulmns.
>
> Out of that I created a index called paid_date_idx
(paid_date).
>
> When I query my database from this table as the following
query.
>
> Select Sum(check_amount) from wo_employee where paid_date >=
> '2004/01/01' and paid_date <= '2004/12/31'
>
> It is not using the index at all. It process sequentially in
> order to sum the amount.
>
> Could someone please tell me how to run this query using the
> index. I am using ASA 8.0
>
> I already tried forcing index, still no use. Please let me
know
> some hints
>
> Thanks
> Karthik
>
>
>
|
|
|
|
|