Changes between Version 27 and Version 28 of DevWikiGardenTest


Ignore:
Timestamp:
12/03/10 05:13:26 (14 years ago)
Author:
robe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevWikiGardenTest

    v27 v28  
    1515   columns are: logid-  an autonumber, log_label - a short description, spatial_class - (will contain geometry or geography), func - name of function being tested, g1 - type of geometry of first geometry, g2 - type of geometry of second or null if a single geometry function, log_start - start time (timestamp), log_end - end time (timestamp), log_sql - the SQL statement that was run.
    1616
    17 If the test crashes before completion, the record with the largest logid will tell you the query that crashed the server..
     17If the test crashes before completion, the record with the largest logid will tell you the query that crashed the server.
    1818
    1919 * postgis_garden_log_output -- this outputs the query results for queries that return something in xml format.  It  uses the built-in query_to_xml function that has existed since PostgreSQL 8.3 to do that.
     
    2222   * log_output - an xml field that contains the query_to_xml output of the query.
    2323
    24 The really nice benefit about logging the query and the output to a table, is that it's easier to inspect and you can also rerun a subset of the queries for closer inspection by just writing an sql statement something like below -- which will test all tests for the ST_Distance function that involve points and linestrings
     24* There is also a companion for raster testing: raster_gardentest.sql.xsl .The raster one doesn't
     25currently create logging labels but will soon.
     26
     27-- to run:
     28-- create the tests
     29There is an unfortunate dependency on postgis_agg_mm.xml which is really not needed
     30just create a dummy blank file called postgis_agg_mm.xml in the trunk/doc to get around this
     31Then:
     32{{{
     33xsltproc -o geo_torturetest.sql trunk/doc/xsl/postgis_gardentest.sql.xsl trunk/doc/postgis.xml
     34xsltproc -o rast_torturetest.sql trunk/doc/xsl/raster_gardentest.sql.xsl trunk/doc/postgis.xml
     35}}}
     36
     37-- run them
     38{{{
     39psql -p 5432 -U postgres -d postgres -c "DROP DATABASE testpostgis;"
     40psql -p 5432 -U postgres -d postgres -c "CREATE DATABASE testpostgis;"
     41psql -p 5432 -U postgres -d testpostgis -c "CREATE LANGUAGE plpgsql;"
     42psql -p 5432 -U postgres -d testpostgis -f postgis.sql
     43psql -p 5432 -U postgres -d testpostgis -f spatial_ref_sys.sql
     44psql -p 5432 -U postgres -d testpostgis -f rtpostgis.sql
     45psql -p 5432 -U postgres -d testpostgis -f geo_torturetest.sql > geo_torturetest_results.txt
     46psql -p 5432 -U postgres -d testpostgis -f rast_torturetest.sql > rast_torturetest_results.txt   
     47
     48}}}
     49
     50One nice benefit about logging the query and the output to a table, is that it's easier to inspect (and you can conceivably do a join between too logging tables to compare results from test to test) and you can also rerun a subset of the queries for closer inspection by just writing an sql statement something like below -- which will test all tests for the ST_Distance function that involve points and linestrings
    2551
    2652{{{
     
    3359}}}
    3460
     61You can even do even more cool things like use [http://developer.postgresql.org/pgdocs/postgres/pgbench.html pgbench] to simulate users with a transaction script that
     62looks something like the below script that will run 10 function queries on functions that
     63start with ST_ that have succeeded in the past.
    3564
    36 There is an unfortunate dependency on postgis_agg_mm.xml which is really not needed
    37 just create a dummy blank file called postgis_agg_mm.xml in the trunk/doc to get around this
    38 Then:
    39 {{{
    40 xsltproc -o torturetest.sql trunk/doc/xsl/postgis_gardentest.sql.xsl trunk/doc/postgis.xml
     65{{{BEGIN;
     66SELECT query_to_xml(log_sql) FROM postgis_garden_log  WHERE func LIKE 'ST_%'
     67and log_end IS NOT NULL ORDER BY random() LIMIT 10;
     68  END;
    4169}}}
     70
    4271
    4372== Version PostGIS 1.5+ ==