New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Piwik log_visit table without using index??? #2254
Comments
That really confused me, since idvisit is the primary key of piwik_log_visit, |
yuanlihao: Yes, idivisit is unique. The idsite and idvisitor in that WHERE clause are effectively redundant. leoyan88: I think there's something wrong with your EXPLAIN or database schema. When I run EXPLAIN, it shows the PRIMARY key is used. |
BTW none of you indicated what version of Piwik you're using or why you're looking at the SQL, but you may be interested in [4204]. |
I agree the other fields are not necessary, but they don't harm neither. |
Thanks for you guys, and sorry for my carelessness. I double checked what vipsoft said, but I still told I didn't use any kind of keys, something wrong with MySQL or any other reasons? mysql> explain select * from piwik_log_visit WHERE idvisit = '2570066'; |
Thanks for you guys, and sorry for my carelessness. Per vipsoft's request, I checked the version of my database, it's mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1 and we're using piwik1.2 right this moment. I have double checked what vipsoft said, but I still be told I didn't use any kind of keys, something wrong with MySQL or any other reasons? mysql> explain select * from piwik_log_visit WHERE idvisit = '2570066'; +----+-------------+-----------------+-------+---------------+---------+---------+-------+------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-----------------+-------+---------------+---------+---------+-------+------+-------+ | 1 | SIMPLE | piwik_log_visit | const | PRIMARY | PRIMARY | 4 | const | 1 | | +----+-------------+-----------------+-------+---------------+---------+---------+-------+------+-------+ Any answers would be appreciated, thanks in advance. |
leoyuan88: we bind the parameters in the SQL statement, so we can use binary data for idvisitor; you can't do the same using the mysql client -- try using hex()/unhex() on the idvisitor field |
UPDATE piwik_log_visit
SET visit_total_actions = visit_total_actions + 1
, visit_exit_idaction_url = '873038'
, visit_exit_idaction_name = '16'
, visit_last_action_time = '2011-04-02 09:27:12'
, visit_total_time = '1347'
WHERE idsite = '53' AND idvisit = '2570066' AND idvisitor = '?^V^C??Q\0?';
idvisit is primary key, and why you use "idsite" and "idvisitor" ???
The text was updated successfully, but these errors were encountered: