On Thu, 26 Feb 2004, Lorderon wrote:

> Hi All,
>
> If I got one table A_table with many columns, and a second table B_table is
> the same but with just primary field and unique field...
> How much meaningful is the time difference between these queries?
> 1. SELECT unique_field FROM A_table WHERE prim_field='val';
> 2. SELECT unique_field FROM B_table WHERE prim_field='val';
>
> If I split A_table into some tables, and define C_table to be MERGE on the
> A_table pieces.
> Is the time difference between selecting from A_table or C_table is
> meaningful?

Unless you have other unstated requirements, from the performance
perspective you are probably better off just making an index on
(prim_field, unique_field) in A_table and getting rid of everything
else.  Then mysql should be able to execute query 1 just as fast
as if it were in B_table; do an "explain" on it, and it should have
"using index" in it, which means it only uses the index to do the
query and doesn't even look at the table rows directly at all.  And you
have no worries about keeping the two in sync.

As for the time difference between query 1 and 2 now, it may be very
tiny or it could be huge, depending largely on if the full table can
fit in cache or if only the primary field / unique field can fit in cache.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to