Comments (4)
I'm looking at #14 but it did not remove the old index as far as I can tell. Also, the composite key that was added is useless as it searches for ip then qid, even though qid is queried first.
from wp-polls.
Oh yes. That is a typo. What do you suggest for #14 actually? I tested theKEY pollip_ip_qid (pollip_ip, pollip_qid)
against https://gist.github.com/archon810/0f6bb97e5a7e29e4d1e9, it seems ok to me. But having said, that I am no way a MySQL expert
from wp-polls.
For me the composite qid/ip key is not picked due to key order. Are the keys created in the same order as my gist?
https://gist.github.com/nerdling/09b84495e3aebef4bc58
Since they're the same cardinality, whichever is the first key gets used. This means they're effectively duplicates, so the former will never be used.
from wp-polls.
I am not too sure whether they are created in the same order. But you are right, the composite key has no effect!
mysql> show keys from wp_pollsip;
+------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| wp_pollsip | 0 | PRIMARY | 1 | pollip_id | A | 44773 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_ip | 1 | pollip_ip | A | 44773 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_qid | 1 | pollip_qid | A | 18 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_ip_qid | 1 | pollip_ip | A | 44773 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_ip_qid | 2 | pollip_qid | A | 44773 | NULL | NULL | | BTREE | | |
+------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
mysql> DROP INDEX `pollip_ip_qid` ON wp_pollsip;
Query OK, 44773 rows affected (0.45 sec)
Records: 44773 Duplicates: 0 Warnings: 0
mysql> show keys from wp_pollsip;
+------------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| wp_pollsip | 0 | PRIMARY | 1 | pollip_id | A | 44773 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_ip | 1 | pollip_ip | A | 44773 | NULL | NULL | | BTREE | | |
| wp_pollsip | 1 | pollip_qid | 1 | pollip_qid | A | 18 | NULL | NULL | | BTREE | | |
+------------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)
mysql> explain SELECT pollip_aid FROM wp_pollsip WHERE pollip_ip = '75.82.197.50' AND pollip_qid = 7;
+----+-------------+------------+------+----------------------+-----------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+----------------------+-----------+---------+-------+------+-------------+
| 1 | SIMPLE | wp_pollsip | ref | pollip_ip,pollip_qid | pollip_ip | 102 | const | 14 | Using where |
+----+-------------+------------+------+----------------------+-----------+---------+-------+------+-------------+
1 row in set (0.00 sec)
mysql> ALTER TABLE wp_pollsip ADD INDEX pollip_ip_qid (pollip_ip, pollip_qid);
Query OK, 44773 rows affected (0.46 sec)
Records: 44773 Duplicates: 0 Warnings: 0
mysql> explain SELECT pollip_aid FROM wp_pollsip WHERE pollip_ip = '75.82.197.50' AND pollip_qid = 7;
+----+-------------+------------+------+------------------------------------+---------------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+------------------------------------+---------------+---------+-------+------+-------------+
| 1 | SIMPLE | wp_pollsip | ref | pollip_ip,pollip_qid,pollip_ip_qid | pollip_ip_qid | 102 | const | 13 | Using where |
+----+-------------+------------+------+------------------------------------+---------------+---------+-------+------+-------------+
1 row in set (0.00 sec)
from wp-polls.
Related Issues (20)
- Remove CSS
- Deregister plugin CSS HOT 1
- Cant create poll
- Multi vote problem HOT 1
- Button color and text not visable HOT 1
- Can't access to "Manage polls" HOT 1
- Ajax on password secured wp-admin folder HOT 2
- Add hooks for all templates rather than just voting form header, body & footer HOT 3
- All poll options returning to "No Poll Option Updated"
- 100% result for last option of new poll in Archive polls
- polls_archive() isn't running the template filters HOT 1
- Poll not appearing on mobile version of site
- PollsWidget not working in new Block-Widget-Area
- [Question] Token based poll concept?
- Admin are shows poll link but 404's
- Feature request: Add box to input name and email when submitting
- Feature Request: GamiPress integration
- Question: dynamic poll HOT 1
- Include a shortcode or/and function to get the latest poll
- Feature proposal - Use of post type Objects as answers HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-polls.