Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 8 of 8 total |
optimizing query |
Wed, Oct 4 2006 4:09 AM | Permanent Link |
"Andre" | Hi,
I use dbisam 4.24 ODBC and php. I have a table (pod) with the following fields: Member ID ID Shipment Number and some other fields Indexs On ID (primary) Member ID;Shipment Number when I run the query SELECT * FROM pod where ([Member ID] ='CDS') and ([ID] ='CDS-200606000058') it takes 0.4 second. when I run the query SELECT * FROM pod where ([Member ID] ='CDS') and ([Shipment Number] ='200509000629') it takes 9.8 seconds Why is this second query so slow. I have an index on the fields Member ID and Shipment Number. Based on the index you should expected that the first query is slow. Thanks for your advice. Andre |
Wed, Oct 4 2006 5:43 AM | Permanent Link |
"Jose Eduardo Helminsky" | Andre
DBISAM only uses first field in the index and therefore you must create another index starting with the field "Shipment Number". Eduardo |
Wed, Oct 4 2006 4:52 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Andre,
<< Why is this second query so slow. I have an index on the fields Member ID and Shipment Number. >> How many rows are being returned by both queries ? -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Oct 5 2006 8:49 AM | Permanent Link |
"Andre" | Hi Tim,
Both queries always (if it exists) returns 1 record. andre "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schreef in bericht news:F726CE0F-8F99-48E2-B9B3-123E5D53B8BF@news.elevatesoft.com... > Andre, > > << Why is this second query so slow. I have an index on the fields Member > ID and Shipment Number. >> > > How many rows are being returned by both queries ? > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Thu, Oct 5 2006 8:51 AM | Permanent Link |
"Andre" | Hi Eduardo
I did and it works. Thanks. Andre "Jose Eduardo Helminsky" <contato@hpro.com.br> schreef in bericht news:FB548462-C3EF-4E1A-85A2-759371B344DD@news.elevatesoft.com... > Andre > > DBISAM only uses first field in the index and therefore you must create > another index starting with the field "Shipment Number". > > Eduardo > |
Thu, Oct 5 2006 4:00 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Andre,
<< Both queries always (if it exists) returns 1 record. >> Actually, I asked that question wrong. What I really needed to know is how many records would have been returned with each query with just the MemberID condition. However, I see that adding the new index solved the problem, so my question is irrelevant now. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Oct 6 2006 3:19 AM | Permanent Link |
"Andre" | Thanks for your reply.
Just for your info. Running the query with only the MemberID set return about 5000 records. Indeed the problem was solved by generating a additional index. Andre "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schreef in bericht news:81B616DD-B120-4868-B8A3-8D78CE6F71ED@news.elevatesoft.com... > Andre, > > << Both queries always (if it exists) returns 1 record. >> > > Actually, I asked that question wrong. What I really needed to know is > how many records would have been returned with each query with just the > MemberID condition. > > However, I see that adding the new index solved the problem, so my > question is irrelevant now. > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Fri, Oct 6 2006 3:58 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Andre,
<< Just for your info. Running the query with only the MemberID set return about 5000 records. >> That's what I thought. In that case, adding another index would help since it would eliminate a 5000 record scan and replace it with a quicker index scan. This is especially true if the record size is rather large ( > 500 bytes). -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |