wiki.techinc.nl/maintenance/archives/patch-pp_sortkey.sql
daniel b1d6e78f74 Introducing pp_sortkey.
This adds the pp_sortkey column to the page_props table.

pp_sortkeys allows for top-k queries for pages, e.g.
the 100 pages with the most language links, etc. It is also
possible to query for exact values.

For now, pp_sortkey will contain pp_value's numeric value if
the value was set to a float, int or boolean.

Associated tasks:
* create a maintenance script for populating pp_sortkey. Tricky,
because when reading from the database, all values are strings.
* create an API module for querying pages by property value.

bug: 58032
Change-Id: I217c42656fb877ff35a36eb446a22bdaf119faac
2014-04-24 05:26:41 +00:00

8 lines
302 B
SQL

-- Add a 'sortkey' field to page_props so pages can be efficiently
-- queried by the numeric value of a property.
ALTER TABLE /*_*/page_props
ADD pp_sortkey float DEFAULT NULL;
CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page
ON /*_*/page_props ( pp_propname, pp_sortkey, pp_page );