Changes

Optimizing views in pgSQL

60 bytes added, 14:23, 6 August 2014
no edit summary
== Examples ==__NOEDITSECTION__
=== View my_view_hazardreductions in Afghanistan ===__NOEDITSECTION__
Version with a very poor performance (approx. 860 seconds / approx. 86'242 000 rows):
<pre>
SELECT type.enumvalue AS Type,
AND customdefinedfield.name = 'CDF-Clearance Type';
</pre>
Optimised version (approx. 160 seconds / approx. 86'242 000 rows):
<pre>
WITH hazreduc_imsmaenum AS (
=== View annualreport_view_bac in Afghanistan ===__NOEDITSECTION__
Version with a very poor performance (more than 15 minutes/ approx. 86'000 rows):
<pre>
SELECT progress.hazreduc_guid AS "ProgressGUID",
my_view_gazetteer.Village;
</pre>
Optimised version (approx. 15 seconds/ approx. 86'000 rows):
<pre>
WITH progress as (
1,068
edits