Hi Dennis, I am stuck up with a problem. I want to calculate the time taken for retrieval of 10,00,000 random records 10,00,000 times. I am using a function getNumber for getting the random number and getTime for getting the current time.getNumber function will return a value between 1 and 10,00,000. When I am passing the range of random number to be generated as 1000, the program is taking 340 seconds to complete. I am not able to give 10,00,000 as the range, since It is going to take a lot time.Y is it so. I am attaching the program with this. Please have a look at it. Can any body tell me where am I going wrong. Is there any other methods that can be used so that I can reduce the retrieval time?
int main(int argc, char *argv[]) { char *database = "test.db"; sqlite3 *db; sqlite3_stmt *select; int col1,rc,i,j; int no_of_rows=1000000,count; char *col2; char *col3; double start_time, end_time, elapsed_time, total_elapsed_time=0; sqlite3_open(database, &db); sqlite3_prepare(db, "select * from data_table where seq_number = ?", -1,&select,NULL ); for(i=0;i<1000000;i++) { j=getNumber(1000000); sqlite3_bind_int(select, 1, j); sqlite3_step(select); start_time=getTime(); //get the starting time of fetching rows col1 = sqlite3_column_int(select,0); col2 = sqlite3_column_text(select,1); col3 = sqlite3_column_text(select,2); end_time = getTime();// getting the ending time of fetching rows elapsed_time = end_time - start_time; total_elapsed_time = total_elapsed_time + elapsed_time; // printf("\n%d %s %s",col1,col2,col3); sqlite3_reset(select); } sqlite3_finalize(select); sqlite3_close(db); printf(" \nRetrieved %d datas in %lf seconds,%lf selects/sec\n\n", no_of_rows,total_elapsed_time,no_of_rows / total_elapsed_time); return 0; } With Regards, Anish Enos Mathew The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of the individual or entity to whom they are addressed and is subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. www.aztecsoft.com