Re: explain
От | Popeanga Marian |
---|---|
Тема | Re: explain |
Дата | |
Msg-id | 3E7BFE7F.2010500@cnlo.ro обсуждение исходный текст |
Ответ на | Re: explain (<mallah@trade-india.com>) |
Ответы |
Re: explain
|
Список | pgsql-sql |
Mallah, Thanks for your info, I runned the query with explain yesterday and it didn't work for a user where i didn't had enough privileges i think !? Why db didn't say anythink ? I created a new user and a new table. Explain for this table worked just as you said and for any other querys. Is there any way to know if a user has wright privileges to explain a query ? mallah@trade-india.com wrote: >Popeanga , > >Its basically possible to get the info programatically. >see below is an example perl code that is getting the >plan data: > >############### file test.pl ################# > >#!/usr/bin/perl > >use DBI; >$dbh = DBI->connect('dbi:Pg:dbname=rmallah' , '',''); >$your_query_here= 'select * from test'; >$rows = $dbh -> selectall_arrayref("EXPLAIN ANALYZE $your_query_here"); >foreach (@$rows) { > print "$_->[0]\n"; >} >$dbh -> disconnect(); >############################################# > >on running you get: > >[rmallah@subho rmallah]$ ./test.pl >Seq Scan on test (cost=0.00..20.00 rows=1000 width=32) (actual time=0.02..0.05 rows=11 loops=1) >Total runtime: 0.19 msec > >But be careful abt explain analyzing >queries that potentially modify data. (read more on docs of EXPLAIN) >we have to put the explain analyze in a transaction block which >shud eventually be rollbacked. > >now that you have seen how to get lines of output from EXPLAIN using/hadling this >data is upto you application. > >also note that the last like of EXPLAIN analyze carries the runtime. > >hope it helps >Mallah. > > > > > > >----------------------------------------- >Get your free web based email at trade-india.com. > "India's Leading B2B eMarketplace.!" >http://www.trade-india.com/ > > > > -- Popeanga Marian DBA Oracle CNLO Romania
В списке pgsql-sql по дате отправления: