[PERFORM] Optimizer's issue

2008-04-23 Thread Vlad Arkhipov
I found strange issue in very simple query. Statistics for all columns is on the level 1000 but I also tried other levels. create table g ( id bigint primary key, isgroup boolean not null); create table a ( groupid bigint references g(id), id bigint, unique(id, groupid)); analyze g; analyz

Re: [PERFORM] SELECT 'DBD::Pg ping test'

2008-04-23 Thread Jeffrey Baker
On Wed, Apr 23, 2008 at 12:19 AM, sathiya psql <[EMAIL PROTECTED]> wrote: > Hi All, > > This query is being executed nearly a million times >SELECT 'DBD::Pg ping test' Something in your Perl application is use $dbh->ping(). See perldoc DBI. It's possible that this is happening un

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread Gregory Stark
"Hans Ekbrand" <[EMAIL PROTECTED]> writes: > No, I just wanted to show the time differences, I haven't used join > before. Now that you have adviced me to, I have tried your suggestion > to rewrite B as a union and it works good! Just as fast as the A Query! You can even do better. If you know th

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread PFC
I should say that this is on postgresql 7.4.16 (debian stable). Whoa. I cannot understand why the following two queries differ so much in execution time (almost ten times) Post EXPLAIN ANALYZE for both, and also post table definitions (with indexes), use \d table. This will allow

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread Theo Kramer
On 23 Apr 2008, at 9:23AM, Hans Ekbrand wrote: I cannot understand why the following two queries differ so much in execution time (almost ten times) Query A (two queries) select distinct moment.mid from moment,timecard where parent = 45 and (pid=17 and timecard.mid = moment.mid) order by

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread Hans Ekbrand
On Wed, Apr 23, 2008 at 10:57:04AM +0200, A. Kretschmer wrote: > am Wed, dem 23.04.2008, um 9:58:10 +0200 mailte A. Kretschmer folgendes: > > > Query A (two queries) > > > > > > select distinct moment.mid from moment,timecard where parent = 45 and > > > (pid=17 and timecard.mid = moment.mid) or

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread hans
On Wed, Apr 23, 2008 at 09:58:10AM +0200, A. Kretschmer wrote: > am Wed, dem 23.04.2008, um 9:23:07 +0200 mailte Hans Ekbrand folgendes: > > I cannot understand why the following two queries differ so much in > > execution time (almost ten times) > > wild guess: different execution plans. > >

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread A. Kretschmer
am Wed, dem 23.04.2008, um 9:58:10 +0200 mailte A. Kretschmer folgendes: > > Query A (two queries) > > > > select distinct moment.mid from moment,timecard where parent = 45 and > > (pid=17 and timecard.mid = moment.mid) order by moment.mid; > > select distinct moment.mid from moment,timecard wh

Re: [PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread A. Kretschmer
am Wed, dem 23.04.2008, um 9:23:07 +0200 mailte Hans Ekbrand folgendes: > I cannot understand why the following two queries differ so much in execution > time (almost ten times) wild guess: different execution plans. Can you show us the plans? (EXPLAIN ANALYSE SELECT ...) > > Query A (two q

[PERFORM] mysterious difference in speed when combining two queries with OR

2008-04-23 Thread Hans Ekbrand
I cannot understand why the following two queries differ so much in execution time (almost ten times) Query A (two queries) select distinct moment.mid from moment,timecard where parent = 45 and (pid=17 and timecard.mid = moment.mid) order by moment.mid; select distinct moment.mid from moment,ti

Re: [PERFORM] SELECT 'DBD::Pg ping test'

2008-04-23 Thread Craig Ringer
sathiya psql wrote: > Hi All, > > This query is being executed nearly a million times >SELECT 'DBD::Pg ping test' > > Why this is being executed ? What is the use ? A client is sending a query to the server solely to see if the server responds. DBD::Pg is the Perl database drive

[PERFORM] SELECT 'DBD::Pg ping test'

2008-04-23 Thread sathiya psql
Hi All, This query is being executed nearly a million times SELECT 'DBD::Pg ping test' Why this is being executed ? What is the use ? Am sure that this query is not executed explicitly. am using postgres 8.1 Any idea ?