Question

I have a table that keeps my payment records. and it has subscriber id field... so when I query this field without index it returns 4 values like so...

select count(id) from `mydb`.`sale_transaction` where subscriber_guid='4d03a32c-3dca-472b-a1db-0dfb0f66e64d';
+-----------+
| count(id) |
+-----------+
|         4 |
+-----------+
1 row in set (0.31 sec)

so I want to get data by this field faster, I added an index like so...

alter table sale_transaction add index subscriber_guid_index(subscriber_guid);
Query OK, 0 rows affected (1.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

then same query again...

select count(id) from `mydb`.`sale_transaction` where subscriber_guid='4d03a32c-3dca-472b-a1db-0dfb0f66e64d';
+-----------+
| count(id) |
+-----------+
|         0 |
+-----------+
1 row in set (0.00 sec)

if I drop index, it works again...

alter table sale_transaction drop index subscriber_guid_index;
Query OK, 0 rows affected (0.06 sec)
Records: 0  Duplicates: 0  Warnings: 0

select count(id) from `mydb`.`sale_transaction` where subscriber_guid='4d03a32c-3dca-472b-a1db-0dfb0f66e64d';
+-----------+
| count(id) |
+-----------+
|         4 |
+-----------+
1 row in set (0.29 sec)

haven't seen something like this before, what is my mistake ?

Was it helpful?

Solution

problem gone with

OPTIMIZE TABLE sale_transaction;

now I can query based on subscriber_guid.

OTHER TIPS

I think the issue is because:

ft_min_word_len variable is not set accurately.

Refer:

http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_ft_min_word_len

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top