<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Forum PostgreSQL - Optymalizacja zapytania]]></title>
	<link rel="self" href="http://forum.postgresql.org.pl/extern.php?action=feed&amp;tid=79&amp;type=atom"/>
	<updated>2008-09-05T15:05:28Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.postgresql.org.pl/viewtopic.php?id=79</id>
		<entry>
			<title type="html"><![CDATA[Optymalizacja zapytania]]></title>
			<link rel="alternate" href="https://forum.postgresql.org.pl/viewtopic.php?pid=272#p272"/>
			<content type="html"><![CDATA[Dlaczego 
działanie zapytania w  funkcji napisanej w plpgsql 
działa bardzo długo  gdy  wykonuje sie ze zmiennymi r,m,k

update ks_dekret set status=1 where id_ks_dow is not null and id_ks_dow not in (select id from ks_dow where rok=$1 and mc=$2 and ksiegi=$3) and rok=$1 and mc=$2 and ksiegi=$3;

natomiast   bardzo szybko dziala gdy  r,m,k zastapimy stałymi

update ks_dekret set status=1 where id_ks_dow is not null and id_ks_dow not in (select id from ks_dow where rok=2008 and mc=7 and ksiegi=0) and rok=2008 and mc=7 and ksiegi=0;


zaznaczam ze   tabela ks_dekret ma okolo  pół milona rekordów,
oraz  to zapytanie zadnego update nie robi  ale sama analiza w tych dwóch przypadkach dziala  różnie.]]></content>
			<author>
				<name><![CDATA[uzi]]></name>
				<uri>https://forum.postgresql.org.pl/profile.php?id=280</uri>
			</author>
			<updated>2008-09-05T15:05:28Z</updated>
			<id>https://forum.postgresql.org.pl/viewtopic.php?pid=272#p272</id>
		</entry>
</feed>
