MySQL Forums
Forum List  »  Performance

Some general questions
Posted by: Alexander Kant
Date: December 14, 2008 08:45AM

1. I have red here then when I have in table1 3 fields like:
id INT(10),
name VARCHAR(30),
description TEXT

and want to find some entries, in this big table, I should split this into two tables, table1:
id INT(10),
name VARCHAR(30),

table2:
description TEXT

Why should I do it for statement like: SELECT * FROM table1 WHERE name = 'alex'
Why should be this faster? MySQL have to search for alex first in column name - and then give the result back, with a description.

---------------------------------------------

2. When I have to tables and following statement:
SELECT t1.*
FROM t1
JOIN t2 ON t1.id = t2.id
WHERE t2.name = 'alex'

is this a better way?:

SELECT t1.*
FROM t1, t2
WHERE t1.id = t2.id
AND t2.name = 'alex'

and what is about this one:

SELECT *
FROM t1,
(SELECT id
FROM t2
WHERE name = 'alex') tmp_table
WHERE t1.id = tmp_table.id

--------------------------------------
3. I have one table with 10000000 companies. My search-engine have to find all companies in new-york, there are (axample) 500000 companies. Now I have to display 10 companies only, ordered by! name - or by postalcode or something else.
I know that order by is problematic - with performance. But before MySQL can give me my 10 companies, it have to sort 500000 compienies? right?
Are there a good solution to solve this problem?

Regards,
Alex

Options: ReplyQuote


Subject
Views
Written By
Posted
Some general questions
3408
December 14, 2008 08:45AM
1551
December 14, 2008 03:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.