X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 34A1A474E4F for ; Sat, 22 Mar 2003 03:44:58 -0500 (EST) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by postgresql.org (Postfix) with SMTP id AE99F474E44 for ; Sat, 22 Mar 2003 03:44:57 -0500 (EST) Received: (qmail 28650 invoked by uid 505); 22 Mar 2003 08:44:42 -0000 Received: from mallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 2.185817 secs); 22 Mar 2003 08:44:42 -0000 Received: from mail-relay.trade-india.com (HELO system67.trade-india-local.com) (203.196.129.235) by ns5.trade-india.com with SMTP; 22 Mar 2003 08:44:40 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: Popeanga Marian Subject: Re: explain Date: Sat, 22 Mar 2003 14:15:02 +0530 User-Agent: KMail/1.5 Cc: pgsql-sql@postgresql.org References: <1114.219.65.253.113.1048264331.squirrel@mail.trade-india.com> <3E7BFE7F.2010500@cnlo.ro> In-Reply-To: <3E7BFE7F.2010500@cnlo.ro> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200303221415.02040.mallah@trade-india.com> X-Spam-Status: No, hits=-26.1 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT autolearn=ham version=2.50-cvs X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50-cvs (1.172-2003-02-14-exp) X-Archive-Number: 200303/519 X-Sequence-Number: 12558 Sorry , I am not sure about this. ie, if a query does not have enough previliegs to run, will its explain be allowed? i hope someone else can throw some light. But i have one suggestion regarding your project spend a *couple* of week studying docs and using postgresql. just a quick weekend may not be enough to gather much understanding for your project. regds mallah. On Saturday 22 Mar 2003 11:41 am, Popeanga Marian wrote: > 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 > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.