![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I have a database +/- 2.600.000 records. I have 5 indexes on this file. One of them is on ProductID, another is on TransactionDate. The file has been uploaded in order of ProductID. When I do a select ProductID, count(*) where productId = 80 - I get after 2 seconds the result (11.000) When I do a select on TranscactionDate, count(*) where TransactionDate=Current_Date() - it takes more then 3 minutes (result = 14.000) When I select another date .. it's going fast (as long as the index is in cache). When I reboot the computer it takes again more then 3 minutes. Now I unloaded and uploaded the file again according to the TransactionDate index. Now the select on the TransactionDate is really fast (2 seconds) and the select on the ProductID takes more then 3 minutes. How is this possible - can this be solved ? Are indexes working in Pervasive SQL2000i ??? Regards, Roland |
#3
| |||
| |||
|
|
I have to ask, just what exactly is "unloaded and uploaded the file again"? |
|
The other question I have is, does the data file have keys matching the SQL indexes? A check database run will let you know if the indexes match or not. If not, they can not be used by the SQL engine. |
|
To see exactly how the database engine is optimizing the query (or not) you may want to run the query plan viewer. Leonard On Sun, 8 Aug 2004 22:00:26 +0200, "Roland Wolfs" r.wolfs (AT) rw-software (DOT) com> wrote: Hi, I have a database +/- 2.600.000 records. I have 5 indexes on this file. One of them is on ProductID, another is on TransactionDate. The file has been uploaded in order of ProductID. When I do a select ProductID, count(*) where productId = 80 - I get after 2 seconds the result (11.000) When I do a select on TranscactionDate, count(*) where TransactionDate=Current_Date() - it takes more then 3 minutes (result = 14.000) When I select another date .. it's going fast (as long as the index is in cache). When I reboot the computer it takes again more then 3 minutes. Now I unloaded and uploaded the file again according to the TransactionDate index. Now the select on the TransactionDate is really fast (2 seconds) and the select on the ProductID takes more then 3 minutes. How is this possible - can this be solved ? Are indexes working in Pervasive SQL2000i ??? Regards, Roland |
![]() |
| Thread Tools | |
| Display Modes | |
| |