[not sure if this the correct category to post]
although there are some solutions for this...
what is, in your opinion, the fastest queries for this?...
C1 | C2 | C3 | C4
------------------
AA | BB | XX | XX
A1 | B1 | 12 | 34
A2 | B2 | XX | XX
When C3 and C4 = XX, UPDATE C3 = C1 AND C4 = C2
C1 | C2 | C3 | C4
------------------
AA | BB | AA | BB
A1 | B1 | 12 | 34
A2 | B2 | A2 | B2
mysql fastest queries
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: mysql fastest queries
Fastest queries? Compared to what?
I would just do
[text]UPDATE mytable SET c3 = c1, c4 = c2 WHERE c3 = 'XX' AND c4 = 'XX'[/text]
Moved to Databases.
I would just do
[text]UPDATE mytable SET c3 = c1, c4 = c2 WHERE c3 = 'XX' AND c4 = 'XX'[/text]
Moved to Databases.
Re: mysql fastest queries
use "explain " to see how your query is executed.
You can create index on C3 and C4 (one index on both fields) to speed up the lookup. You have to test if this will give you better results in terms of performance
You can create index on C3 and C4 (one index on both fields) to speed up the lookup. You have to test if this will give you better results in terms of performance