Allow me to demonstrate my pitiful SQL knowledge
I have tables documents and comments
If I run join and list doc_nums the query is quite fast
If I run join and use subselect the query is extremely slow
Can someone offer analysis
Thanks
Richard
dcc=# EXPLAIN ANALYZE select doc_num from documents
I've been foolin with this for a couple of days
Sometimes you just have to ask
Thanks gentlemen
On Tue, 5 Dec 2006, Tom Lane wrote:
Richard Ray <[EMAIL PROTECTED]> writes:
dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on
(documents.doc_num = comments.doc
The query
select count(*) from documents where doc_num = '106973821' and (select
bit_or(group_access) from mda_groups where group_name in (select groname
from pg_user,pg_group where usename = 'bbob' and usesysid = any(grolist)
and (groname ~ '.*owner$' or groname = 'admin'))) & access >
'0
On Thu, 7 Dec 2006, Thomas Pundt wrote:
Hi,
On Wednesday 06 December 2006 16:44, Richard Ray wrote:
| select count(*) from documents where doc_num = '106973821' and (select
| bit_or(group_access) from mda_groups where group_name in (select groname
| from pg_user,pg_group whe
On Thu, 7 Dec 2006, Tom Lane wrote:
Richard Ray <[EMAIL PROTECTED]> writes:
On Thu, 7 Dec 2006, Thomas Pundt wrote:
Just a guess: is the column "doc_num" really of type text? Maybe using "text"
in the function lets the planner choose a sequential scan?
Actua
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ language 'plpgsql';
I'm not having a lot of luck
Thanks
Richard
---
;days')::interval;
return next a;
return;
end
$$ language 'plpgsql';
This works quite well
I never looked at it that way
Thanks
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard Ray
Sent: Tuesday, December 19, 2006 12
On Tue, 19 Dec 2006, Milen A. Radev wrote:
Richard Ray :
How should this be properly quoted
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now() - interval '$1 day';
return next a;
return;
end
$$ languag
It makes sense when ya'll explain it
It never sounds that good when I'm talkin to myself
That solves my problem but not my ignorance
I'm still curious about how would I properly quote
create or replace function test(integer) returns setof text as $$
declare
a record;
begin
select into a now()
This may be a simple but can I create a query such as
select (select attname from pg_attribute where attrelid = (select
relfilenode from pg_class where relname = 't1') and attisdropped =
false and attnum > 0) from t1;
I get
ERROR: more than one row returned by a subquery used as an expressio
ropped IS FALSE
AND pa.attnum > 0;
Let me know if it doesn't do what you intended.
On Mon, 22 Jan 2007, Richard Ray wrote:
This may be a simple but can I create a query such as
select (select attname from pg_attribute where attrelid = (select
relfilenode from pg_class wh
arlier. What information are you trying to
extract?
On Mon, 22 Jan 2007, Richard Ray wrote:
This is not exactly what I need
I want to return the data in t1
On Mon, 22 Jan 2007, Jeff Frost wrote:
I think this is what you're looking for Richard:
SELECT attname FROM pg_attribute pa, pg_class pc
On Mon, 22 Jan 2007, Jeff Frost wrote:
So why are you avoiding "SELECT * FROM t1;" ?
I was affeared that if I brought my total ignorance to light I would be
band from the list but here goes.
I work in UNIX/Linux environments.
It's my habit to record my scripts.
A simple example:
#!/bin/bash
about 20 minutes
My simple solution is "select * into t2 from t1 where length(bar) = 0;"
and "select * from t2 order by foo ;"
Is there a way to make "select * from t1 where length(bar) = 0 order by foo ;"
or something similar work
Thanks
Richard
On Fri, 31 Aug 2007, Michael Glaesemann wrote:
On Aug 31, 2007, at 13:32 , Richard Ray wrote:
"select * from t1 where length(bar) = 0;" runs about 2 minutes
"select * from t1 where length(bar) = 0 order by foo ;" ran until I
stopped it after about 20 minutes
EXPLAIN A
On Fri, 31 Aug 2007, Tom Lane wrote:
Richard Ray <[EMAIL PROTECTED]> writes:
On Fri, 31 Aug 2007, Michael Glaesemann wrote:
EXPLAIN ANALYZE will help you see what the planner is doing to produce the
results.
mda=# EXPLAIN ANALYZE select * from t1 where length(bar) = 0 order
Thanks guys
Lesson learned
On Tue, 4 Sep 2007, Scott Marlowe wrote:
On 8/31/07, Richard Ray <[EMAIL PROTECTED]> wrote:
Changing to enable_seqscan = on does solve this problem, thanks
Is there some method of crafting a query that will assert my wishes to the
planner
When is enable_s
17 matches
Mail list logo