MySQL - Why does a select statement on an indexed column return the index information, and not the column data? -


i have table (innodb) stores activity log. each row has user id, activity id, , location data. user id , activity id columns indexed, though not unique.

when query select * data returned looks normal -

select * table 

when query user id or activity id column (even 2 together), data looks normal.

select user_id, city table 

when query user id or activity id statement, data looks normal.

select user_id table city = 'boulder' 

the issue arises when query user id or activity id alone, or query 1 statement on same column substring query.

select user_id table 

or

select user_id table substring(user_id, 1,5) = '12345' 

the data returned not data in field, looks index location (or similar). dropped indexes, , problem fixed, reappeared added indexes back.

example without index -

user_id    ------- 123456789 231234567 234567543 

example index -

user_id ------- 081357652234 100000000000000 1000000000011 

i've tried restarting server, , reloading data api, nothing helped. i've tested on other tables in same database without experiencing problem.

is bug or mistake made in configuration?

i would:

  • change name of table (i see updated user_activity) avoid possible bugs due table name being keyword in sql
  • make backup of db
  • run check table user_activity errors
  • check user_id int type

update: can see 1 of comments user_id varchar, may have run bug because second , third id returned query binary. you're working innodb can't run repair can @ this. may idea dump db , reload see if problem circumstantial or consistently happening no matter what.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -