Project

General

Profile

# Date Author Comment
13084 04/09/2014 02:55 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _specimens_10_count_number_of_records_by_institution: ran through pipeline

13082 04/09/2014 02:46 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql, validation/aggregating/specimens/qualitative_validations_specimens.sql: _specimens_10_count_number_of_records_by_institution: need to dereference specimenreplicate.duplicate_institutions_sourcelist_id to the corresponding sourcelist.name

13081 04/09/2014 02:40 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations._specimens_*: added comments from validation/aggregating/specimens/qualitative_validations_specimens.sql

13071 04/08/2014 01:52 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: remake_diff_tables(schema text): removed bien2_traits runtime because this applies only to one datasource. the bien2_traits runtime is now documented in inputs/bien2_traits/run.

13069 04/08/2014 01:38 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: schema comment: documented how to run the validations. this information is also in the usage comment for public_validations.remake_diff_table(), but is copied here for easy reference.

13066 04/07/2014 06:21 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: specimens queries: added autogenerated ~type tables

13063 04/07/2014 06:07 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: added specimens queries to pipeline

13060 04/07/2014 05:17 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: public_validations.rematerialize_out_view(text, regclass): run with join_collapse_limit = 1 to fix query planner issues. this option has been tested on the queries that do not yet use the standard join sequence (plots #11,12,13,14,16,17,18), and all of these queries also work fine with join_collapse_limit = 1. (the standard join sequence is used to ensure both correctness of the query and compatibility with join_collapse_limit = 1, but in some cases is not needed for join_collapse_limit.)

12994 03/30/2014 06:28 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: schemas/vegbien.sql(): need to util.use_schema(schema_anchor) before initializing vars that use own-schema functions

12966 03/28/2014 07:17 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: updated _specimens_01_count_of_total_records_specimens_in_source_db

12933 03/27/2014 08:04 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: added _specimens_01_count_of_total_records_specimens_in_source_db

12886 03/24/2014 05:35 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: specimenreplicate.institution_id: renamed to duplicate_institutions_sourcelist_id, as decided in the conference calls (wiki.vegpath.org/2014-03-13_conference_call#schema-changes-2)

12687 03/13/2014 06:53 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _plots_08_list_of_plots_which_use_percent_cover, _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro: reran with fixes, which removes the incorrectly auto-added copies columns. (they were only able to be auto-added because the tables had no rows.)

12680 03/13/2014 05:04 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: implemented _plots_19_count_of_censuses_per_plot_in_each_project

12675 03/13/2014 01:50 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: schema comment: changed "to sync the queries with schemas/vegbien.sql" to "to reset the queries to what's in schemas/vegbien.sql" for clarity

12674 03/13/2014 01:46 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: schema comment: to reset the key and value columns for all validations queries: updated running of custom keys() functions to use keys() types instead

12673 03/13/2014 01:14 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: schema comment: to sync the queries with schemas/vegbien.sql: use new public_validations.rm_output_queries() instead of rm_all_queries() to leave the input queries in place

12672 03/13/2014 01:12 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: schema comment: documented how to reset the key and value columns for all validations queries

12669 03/12/2014 11:49 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: rm_output_queries(): also need to include keys_* and values__* types, as these are also associated with the query

12666 03/12/2014 06:26 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: regenerated ~type tables, which adds `copies` columns for queries with a mismatch in the # of occurrences of each row

12665 03/12/2014 06:18 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: public_validations.validation_views(): need to include views with letters after the query # (eg. _plots_06a_list_of_stems)

12648 03/12/2014 04:44 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations schema comment: added instructions to change the key and value columns for a validations query

12647 03/12/2014 04:41 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: implemented _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj

12644 03/12/2014 03:35 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: implemented _plots_09_list_of_plots_which_use_line_intercept

12643 03/12/2014 03:20 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: queries that use EXISTS: join locationevent.plot_id to plot.plot_id directly instead of going via location.plot_location_id

12642 03/12/2014 03:04 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: implemented _plots_08_list_of_plots_which_use_percent_cover

12640 03/12/2014 12:01 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: implemented _plots_07_list_of_plots_which_use_counts_of_indiv_per_species

12635 03/07/2014 10:49 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql, inputs/SALVIAS/validations.sql: added _plots_06a_list_of_stems, for use in figuring out the diff in _plots_06_list_of_plots_with_stem_measurements

12633 03/07/2014 09:50 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: plot: removed explicit column lists added in the autorename of plot.location_id->plot_id

12632 03/07/2014 09:41 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: plot: renamed pkey to plot_id. note that the field is autorenamed in all validation views which use it.

12631 03/07/2014 09:18 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: locationevent: added autopopulated plot_id column which points to the outermost plot of the locationevent's location

12630 03/07/2014 08:55 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: locationevent: added missing fkey on place_visit_id

12629 03/07/2014 04:42 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: _plots_06_list_of_plots_with_stem_measurements: only include stemobservation records which have actual stem IDs, not merely stem-related measurements (DBH, etc.)

12626 03/07/2014 05:35 AM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: _plots_06_list_of_plots_with_stem_measurements: LEFT JOIN to project instead of inner joining, to get Postgres to use the right query plan. this is the last change needed to make query #6 runnable.

12625 03/07/2014 05:25 AM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: rematerialize_out_view(): run all queries with `SET enable_seqscan = off` to avoid slow query plans. this fixes _plots_06_list_of_plots_with_stem_measurements and significantly speeds up _plots_10_count_of_individuals_per_plot_in_each_project (and possibly others).

12624 03/07/2014 05:23 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: locationevent: documented `CREATE INDEX locationevent_place_visit_id` runtime (3 min)

12623 03/07/2014 04:53 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: locationevent: added locationevent_place_visit_id index to facilitate joins to place_visit_id in the validations queries

12621 03/06/2014 10:45 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: source_by_shortname(): documented that in some cases, it is actually a bad idea to use a nested SELECT, because this will prevent Postgres from using an index scan (causing an equally bad slowdown as not inlining in cases where a nested SELECT is required).

12619 03/06/2014 10:21 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: locationevent: documented `VACUUM ANALYZE` runtime (20 min)

12615 03/06/2014 07:35 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: location: documented `CREATE INDEX plot_source_id` runtime (5 min)

12614 03/06/2014 07:30 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: location: added plot_source_id index to provide the equivalent of the location.source_id index for outer plots. this will help Postgres choose the right query plans in queries involving outer plots.

12606 03/06/2014 08:57 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _plots_18_list_of_subplots_codes_for_each_plot_for_each_project: added ~type table

12604 03/06/2014 08:31 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro: added ~type table

12598 03/06/2014 12:33 AM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: _plots_10a_aggregate_observation_individual_counts: need to use taxonoccurrence.sourceaccessioncode, not aggregateoccurrence.sourceaccessioncode, because aggregateoccurrence.sourceaccessioncode is not populated

12597 03/06/2014 12:09 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations schema comment: documented how to remove a validations query so its columns can be changed (use public_validations.rm_query_view())

12596 03/06/2014 12:07 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql, inputs/SALVIAS/validations.sql: added _plots_10a_aggregate_observation_individual_counts, for use in debugging diffs in _plots_10_count_of_individuals_per_plot_in_each_proj

12589 03/05/2014 12:13 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: locationevent: documented `UPDATE locationevent SET place_visit_id = place_visit_id` runtime (>~1 h)

12586 03/05/2014 07:23 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: _plots_10_count_of_individuals_per_plot_in_each_project: fixed to handle subplots properly, using new locationevent.place_visit_id

12585 03/05/2014 01:02 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: added place_visit view, analogous to plot but for top-level locationevents. this is needed by the SALVIAS validation queries.

12584 03/05/2014 12:59 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: locationevent: added locationevent_set_place_visit_id() trigger, analogous to location_set_plot_location_id() but for the locationevent nesting hierarchy. this is needed by the SALVIAS validation queries.

12583 03/05/2014 12:32 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: location_set_plot_location_id(): removed incorrect comment that this is a pull-forward trigger

12582 03/04/2014 05:56 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: public_validations.query_view_relation_max_prefix_len(): added values__ prefix

12580 03/04/2014 05:48 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: re-auto-added keys(), values_() functions for all queries

12578 03/04/2014 05:40 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: re-auto-added keys(), values_() functions for all queries

12573 03/04/2014 04:56 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: auto-added values_() functions for all queries

12566 03/04/2014 03:49 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: auto-added keys() functions for all queries

12557 03/04/2014 02:20 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: synced with DB, which reorders ~type tables

12552 02/28/2014 11:17 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: public_validations: schema comment: also need to re-create keys() functions after running public_validations.rm_all_queries()

12551 02/28/2014 11:13 PM Aaron Marcuse-Kubitza

bugfix: schemas/vegbien.sql: added back keys() matchup functions, which get cascadingly deleted when the queries are re-created to change column names, etc. note that this causes the associated ~type tables to sort before them.

12550 02/28/2014 11:11 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: added new ~type tables

12547 02/28/2014 10:03 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: rm_all_queries(schema): documented this function's unexpected behavior when schema = public_validations (it removes in all schemas, not just public_validations). this is because this uses rm_query_view().

12546 02/28/2014 09:49 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: use plot (which includes only outer plots) instead of location, to match the input queries

12545 02/28/2014 08:15 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: rm_query_group(): support removing all validations as well as just those with a particular group prefix (and renamed to rm_output_queries())

12544 02/28/2014 07:57 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: public_validations: schema comment: removed incorrect "" in `SET search_path = "public_validations", pg_catalog;` now that they are no longer auto-added

12542 02/28/2014 07:51 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: synced with DB, which reorders ~type tables

12537 02/27/2014 07:53 PM Aaron Marcuse-Kubitza

schemas/util.sql: raise_error_notice(): raise a WARNING instead because this is for errors, and rename to raise_error_warning() to match

12536 02/27/2014 07:49 PM Aaron Marcuse-Kubitza

schemas/util.sql: raise_error_notice(): raise a WARNING instead because this is for errors, and rename to raise_error_warning() to match

12528 02/27/2014 07:08 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: added back traits* ~type tables

12527 02/27/2014 07:02 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: plots* validation queries: renamed plot_code columns (with names plotcode, plotCode, SiteCode) to match the input queries (plot_code)

12525 02/27/2014 06:42 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: rm_all_queries(): all-schemas mode: also remove queries that are only present on the input side, so that the input side can also be re-created from the DDL file

12524 02/27/2014 06:36 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: rm_all_queries(): documented that this actually does remove queries in all schemas when schema is NULL, because rm_query_view(public_validations.view) searches all schemas

12523 02/27/2014 04:37 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: top_plot view: renamed to plot, as requested by Brad (wiki.vegpath.org/2014-02-27_conference_call#schema-changes)

12521 02/27/2014 03:51 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: location.top_plot: renamed to plot_location_id, as requested by Brad (wiki.vegpath.org/2014-02-27_conference_call#schema-changes)

12520 02/27/2014 02:20 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: source_by_shortname(): documented exact time that the slow query ran for (5013s = ~1.5 hours)

12519 02/27/2014 02:07 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations: schema comment: documented how to sync the queries with schemas/vegbien.sql

12518 02/27/2014 02:05 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: public_validations.rm_all_queries(): when called with no args, operate on public_validations instead of all schemas, since this is the more common use case (replacing just the output queries, not both input and output)

12517 02/27/2014 01:49 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: rm_query_group(): documented that this only removes validations output queries (in public_validations), as it is designed for use in updating all output queries at once from the testing DB

12516 02/27/2014 01:27 PM Aaron Marcuse-Kubitza

bugfix: *.sql: public.source_by_shortname(): need to wrap it in a nested SELECT because Postgres incorrectly does not constant-fold (inline) it, leading to a slowdown when it is therefore run many times. this is done using the steps at wiki.vegpath.org/Postgres_queries#wrap-function-call-in-nested-SELECT .

12515 02/27/2014 12:43 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: source_by_shortname(): documented that it must be run as a nested SELECT, because otherwise Postgres will not inline it. not inlining causes the query to be run for each row in a table of potentially millions, and creates a significant slowdown (eg. >1.5 hours for SALVIAS._plots_06_list_of_plots_with_stem_measurements)

12513 02/27/2014 06:51 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: source_by_shortname(): needs to be declared STABLE so it can be constant-folded and only run once per query. (it had previously been VOLATILE because of constraints imposed on functions that run `SET LOCAL search_path`.)

12511 02/27/2014 01:11 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: location: added index on top_plot

12510 02/27/2014 01:06 AM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: _plots_06_list_of_plots_with_stem_measurements: changed columns to match input query

12509 02/27/2014 01:04 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: added more ~type tables for plots queries

12507 02/26/2014 11:44 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: added public_validations.rm_all_queries(schema), which removes all validations queries in a schema, or in all schemas (useful when recreating validations queries from the DDL export file)

12506 02/26/2014 11:29 PM Aaron Marcuse-Kubitza

schemas/util.sql: validation_views(): moved filtering out of _validations schemas to validatable_datasources() so that calling this function with no args gives the validation views in *all schemas as one would expect

12505 02/26/2014 10:58 PM Aaron Marcuse-Kubitza

schemas/util.sql: query_relations(): support passing in an input query instead of an output query, which will remove only in the datasource's schema. (note that it was not clear that passing in an input-side query was not previously supported.)

12503 02/26/2014 10:30 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: schema_anchor: clarified that this identifies this function's schema (for use in locating helper functions), but is not necessarily the schema operated on, as the comment implied

12500 02/26/2014 01:16 PM Aaron Marcuse-Kubitza

fix: schemas/vegbien.sql: _plots_04_count_of_plots_in_each_project_in_this_source: count top-level plots to match the input query

12499 02/26/2014 12:29 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: remake_diff_table(): instructions for how to regenerate the diff table: put these at the beginning of the table comment instead of the end, because they are the most important info about the table that a user needs to know

12497 02/26/2014 11:37 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: replaced custom %== operators with much simpler custom keys() functions. this avoids both the need to write out an = comparison for each field, and especially, also the need to write both an operator and a function implementing that operator.

12492 02/25/2014 11:36 PM Aaron Marcuse-Kubitza

schemas/util.sql, vegbien.sql: comment about "function option search_path": don't include `mk_set_search_path()` since that is no longer used

12490 02/25/2014 11:28 PM Aaron Marcuse-Kubitza

schemas/util.sql: use_own_schema(): renamed to use_schema() because this can be used for any type-linked schema

12489 02/25/2014 11:23 PM Aaron Marcuse-Kubitza

bugfix: rematerialize_out_view(): set_search_path() does not take the same arguments as mk_set_search_path() did, so need to use mk_search_path() instead

12484 02/25/2014 10:48 PM Aaron Marcuse-Kubitza

schemas/util.sql, vegbien.sql: use util.use_own_schema()/util.set_search_path() instead of EXECUTE util.mk_use_own_schema()/util.mk_set_search_path()

12441 02/25/2014 11:37 AM Aaron Marcuse-Kubitza

schemas/util.sql, vegbien.sql: do not declare IMMUTABLE SQL-language functions as STRICT, because this prevents them from being inlined (as documented in the util schema comment)

12435 02/25/2014 10:29 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: synced from DB, which changes the order of the ~type tables

12425 02/25/2014 07:52 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _plots_04_count_of_plots_in_each_project_in_this_source: added operator %== to match the rows by project_name

12424 02/25/2014 07:42 AM Aaron Marcuse-Kubitza

bugfix: schemas/util.sql: diff(text, text) and types that use its custom FULL JOIN matching: need to use separate operator %== for determining which records to put on the same row, so that the = filter for identical rows only excludes rows that are actually the same, not all rows with the same keys (which would usually remove all rows)

12422 02/25/2014 07:14 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: synced from DB, which changes the order of the ~type tables

12421 02/25/2014 12:24 AM Aaron Marcuse-Kubitza

schemas/vegbien.sql: _plots_02_list_of_project_names: added = operator that causes FULL JOIN to only use some columns, so that rows for the same label column are put on the same row in the diff table