Link to home
Start Free TrialLog in
Avatar of terminator_4
terminator_4

asked on

Memory resident table is taking much time compared to disk resident table.......

I have created this table ....
create table  Rules_horizontal (
         Fragment_name varchar(20) not null,
         Attribute_name varchar(20) not null,
                         |              |               |
                         |              |               |
         primary key(Fragment_name,Attribute_name),
         index (Fragment_name)
) ;

and the below code snippet is taking 0.586 secs for execution
-----------------------------Begin Snippet------------------------------------------
 Line:12        while ((row1 = mysql_fetch_row(pResult)) != NULL)  {
 Line:13                    temp = row1[0];
 Line:14                   sqlQuery="select * from Rules_horizontal where Fragment_name='"+temp+"'";
 Line:15                  qResult=get_result(sqlQuery.c_str());
                        }
------------------------End Snippet----------------------------------------------------
but when I kept the table in memory.....
create table  Rules_horizontal (
         Fragment_name varchar(20) not null,
                         |              |               |
         primary key(Fragment_name,Attribute_name),
         index (Fragment_name)
)  Type = Heap;

the above code snippet is taking 5min .456 secs ..............Line14 is taking a long time for exection.......
Memory resident Table shud take less time than disk resident table but i am getting the opposite...............
Am I doing any mistake??? ........... Plz help.

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of terminator_4
terminator_4

ASKER

Number of Rows: 6000
RAM: 256 MB
OS: FC2
mysql  Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial