create table foo (id int(11) auto_increment, value varchar(255))
The table contains roughly 10,00,000 rows and select operations like select id, value from foo take around 2-3 secs to execute, how do I improve the speed here
select id, value from foo is going to return the whole table. The 2-3 seconds you mention could include the time it takes to transfer your results. This can often be much longer than it takes you database server to execute the actual query.
If there is no WHERE clause (like the query you posted) and you are selecting one million rows, there is a good chance that rather than the query taking 2-3 secs to execute it's in fact taking that time to send the data across the network.
Can your application actually use a million database records at once? If you are showing that data to a user then you are likely going to be paging it, so change your query to select data in more manageable chunks.
SELECT id, value
FROM foo
LIMIT $offset, $pgsize -- these two values will come from your application
If you really, really need all those rows at once, then I suggest you cache them.
Add an index to the fields used in the where clause.
CREATE INDEX id_index ON foo (id) USING BTREE;
You can see more info at http://dev.mysql.com/doc/refman/5.0/en/create-index.html