Ask a Question related to IBM DB2, Design and Development.
-
Erwin #1
Optimizing Query
Can anybody tell me how to improve the performance of this query?
SELECT
NID, LEVEL, VALUE
FROM
DATA
WHERE
DID=2 AND STATUS=0
The value of STATUS is either 0 or 1. The primary key of DATA is EID
which I don't use in the query.
The total cost of the query without index is 240.47
If I put index on DID and STATUS, the total cost is 190.47.
Thanks
Erwin
Erwin Guest
-
Help Optimizing Query
Just looking to see if anyone has any pointers on how i can optimize this query... it is taking about a minute to show the data, and even though its... -
Help in optimizing a slow query...
Hello, I'm trying since weeks (with no luck...) to optimize a query which is "killing" my site on peak times (100+ visitors simultaneously). I... -
Tools for optimizing mysql query
I have googled a lot, but couldn't find it. But, I hope that there will be a tool for query optimization (a tool that can automatically detect the... -
Optimizing PDF
Hey, I have a pdf that i am trying to optimize because it is 14 megs in size. WHen i use the pdf optimizer, i get an message that says "THe... -
Optimizing for CD playback
I'm working on a Director Movie the final will be distributed on a CD as a projector file. The presentation is 4-5 minutes long and will consist... -
Joerg Ammann #2
Re: Optimizing Query
[email]erwin2@myrealbox.com[/email] (Erwin) wrote in message news:<43ecf6d7.0308130142.3091870d@posting.google. com>...
datatype of STATUS ?> Can anybody tell me how to improve the performance of this query?
>
> SELECT
> NID, LEVEL, VALUE
> FROM
> DATA
> WHERE
> DID=2 AND STATUS=0
>
> The value of STATUS is either 0 or 1. The primary key of DATA is EID
> which I don't use in the query.
>
> The total cost of the query without index is 240.47
> If I put index on DID and STATUS, the total cost is 190.47.
>
> Thanks
>
> Erwin
did you a
runstats WITH DISTRIBUTION
on the table?, otherwise the optimizer does not know that there are
only 2 different values for STATUS.
Joerg Ammann Guest
-
Erwin #3
Re: Optimizing Query
> datatype of STATUS ?
I use SMALLINT. Actually, I need only two values for STATUS.
I didn't execute RUNSTATS WITH DISTRIBUTION on the table. I try to> did you a
> runstats WITH DISTRIBUTION
> on the table?, otherwise the optimizer does not know that there are
> only 2 different values for STATUS.
execute RUNSTATS WITH DISTRIBUTION, and it works.
Thanks :)
Erwin Guest



Reply With Quote

