-
Notifications
You must be signed in to change notification settings - Fork 262
Data organization
Relationship data is stored in two custom database tables.
Current schema:
wp_p2p:
- p2p_id
- p2p_from
- p2p_to
- p2p_type
wp_p2pmeta:
- p2p_id
- meta_id
- meta_key
- meta_value
The plugin data organization went through several iterations:
P2P 0.1 simply used custom fields to store connections. This turned out to be slow, because the wp_postmeta.meta_value
column is defined as longtext
, with no index.
P2P 0.3 switched to using a hidden taxonomy. This worked reasonably well, even though the queries were pretty strange.
In P2P 0.4, two custom tables were introduced: wp_p2p and wp_p2pmeta.
This resulted in simple and efficient queries, as well as the ability to add additional information per connection, using the familiar metadata API.
In P2P 1.1, an addtional p2p_type
column was added to the wp_p2p
table, to be able to distinguish between ids of various objects: posts, users etc.