hey..i got a microsoft access db with a table called items which has more than 100,000 records.So in my application when i search for some item it takes some time to give me the result in the data grid.
Basically what i do is add each item object to arraylist and then return it to print in the datagrid.im new to c# and i wanna knw a bettr method to do my search wher it takes less time ..thanks in advance..
Best regards,
Hussain
Loading
Kirtan PatelPosted Dec 26, 2009, 8:29 AM
Create Indexes in Database that will make Search Faster.
also
Use Common DataSet ..globally instead of Filling Different DataSets or Executing DataReaders on Every Search..
That Will reduce Search time as We Dont Need to Consult Database Every time ..
Hussain MulthazimPosted Dec 26, 2009, 12:27 PM
Kirtan PatelPosted Dec 26, 2009, 9:31 AM
if you are Searching database from Primary Key ( Code ) then Create Index on Code Field . else if you directly passing Crushed Data In Search Query then Create Index on that Field.
since its Text Data it will take more memory to create index.
Create Index as I told you the process how to create both type of Indexes ..
Hussain MulthazimPosted Dec 26, 2009, 9:08 AM
Table - Item
----------------------
Code
ItemDetails
DateofPurchase
PurchaseFrom
Cost
SellingPrice
PriceSold
DateOfSale
BillNo
Remarks
Category
CrushedData
--------------------------
thats my table design.basically whenever i add a record, CrushedData field will contain all values for that particular row in that table.e.g.
Item
Code
Description
DateofPurchase
PurchaseFrom
Cost
SellingPrice
PriceSold
DateOfSale
BillNo
Remarks
Category
CrushedData
ABE 341
Embroidery Work
14.11.99
Andrew
850
1500
1400
04.01.00
919
Embroidery
ABE 341,Embroidery Work,Andrew,, Embroidery,919,04.01.00
So when i search for a record i write a like query for CrushedData field. So if i hav index this field which method is best..single-field index or multiple fild index ?? and hw to do it ???
Kirtan PatelPosted Dec 26, 2009, 8:50 AM
Creating a Single-Field Index
To create a single-field index, follow these steps:Creating Multiple-Field Index
If you will often search or sort by two or more fields at a time, you can create an index for that combination of fields. For example, if you often set criteria for LastName and FirstName fields in the same query, you should create a multiple-field index on both fields.When you sort a table by a multiple-field index, Microsoft Access sorts first by the first field that is defined for the index. If there are records with duplicate values in the first field, Microsoft Access sorts next by the second field defined for the index, and so on.
You can include up to 10 fields in a multiple-field index.
To create a multiple-field index, follow these steps:
Hussain MulthazimPosted Dec 26, 2009, 8:48 AM