Re: [GENERAL] Question on a select

2005-01-02 Thread Pierre-Frédéric Caillaud
I didn't realize that the order made a difference. A sign of how much learning I need to do. :p For reference, I think 'file_parent_dir' and 'fs_parent_dir' are the most important because I do an 'ORDER BY [fs|file]_parent_dir ASC' on most queries. I've made the changes, thank you again

Re: [GENERAL] Question on a select

2005-01-02 Thread Madison Kelly
Vincent Hikida wrote: The indexes are: CREATE INDEX file_info_#_display_idx ON file_info_# (file_type, file_parent_dir, file_name); CREATE INDEX file_set_#_sync_idx ON file_set_# (fs_name, fs_parent_dir, fs_type) Are these not effective for the second query? If not, what should I change or

Re: [GENERAL] Question on a select

2005-01-02 Thread Vincent Hikida
The indexes are: CREATE INDEX file_info_#_display_idx ON file_info_# (file_type, file_parent_dir, file_name); CREATE INDEX file_set_#_sync_idx ON file_set_# (fs_name, fs_parent_dir, fs_type) Are these not effective for the second query? If not, what should I change or add? If so, would you

Re: [GENERAL] Question on a select

2005-01-02 Thread Vincent Hikida
They are all 'not null' and I am trying to do exactly the kind of task you described. I tried the first example on my DB and got a syntax error: tle-bu=> SELECT a.file_name, a.file_parent_dir, a.file_type FROM file_info_1 a WHERE NOT EXIST (SELECT NULL FROM file_set_1 b WHERE b.fs_name=a.file

Re: [GENERAL] Question on a select

2005-01-02 Thread Madison Kelly
Bruno Wolff III wrote: There should be parenthesis around the list to test. WHERE a_name, a_type, a_dir NOT IN ( should be WHERE (a_name, a_type, a_dir) NOT IN ( That did it (I think)! I believe that the NOT IN query should run comparably to the LEFT JOIN example supplied by the other person (at le

Re: [GENERAL] Question on a select

2005-01-01 Thread Bruno Wolff III
On Sun, Jan 02, 2005 at 01:58:20 -0500, Madison Kelly <[EMAIL PROTECTED]> wrote: > Bruno Wolff III wrote: > >SELECT a_name, a_type, a_dir, a_ FROM table_a > > WHERE a_name, a_type, a_dir NOT IN ( > >SELECT b_name, b_type, b_dir FROM table_b) > >; > > > >In pre 7.4 versions or if there are NU

Re: [GENERAL] Question on a select

2005-01-01 Thread Madison Kelly
Bruno Wolff III wrote: SELECT a_name, a_type, a_dir, a_ FROM table_a WHERE a_name, a_type, a_dir NOT IN ( SELECT b_name, b_type, b_dir FROM table_b) ; In pre 7.4 versions or if there are NULLs in the key columns for table_b then you probably want to use NOT EXISTS (with a moodified WHERE clau

Re: [GENERAL] Question on a select

2005-01-01 Thread Madison Kelly
Vincent Hikida wrote: There are several ways. I am making the simplifying assumption that name, type and dir cannot be NULL in either table. If they are the query is a little more complicated. The following are a couple of many techniques. SELECT a.a_name , a.a_type , a.a

Re: [GENERAL] Question on a select

2005-01-01 Thread Bruno Wolff III
On Sat, Jan 01, 2005 at 22:32:17 -0500, Madison Kelly <[EMAIL PROTECTED]> wrote: > Hi all, > > This is my first post here so please let me know if I miss any list > guidelines. :) > > I was hoping to get some help, advice or pointers to an answer for a > somewhat odd (to me at least) SELE

Re: [GENERAL] Question on a select

2005-01-01 Thread Vincent Hikida
no authors? etc. - Original Message - From: "Madison Kelly" <[EMAIL PROTECTED]> To: "PgSQL General List" Sent: Saturday, January 01, 2005 7:32 PM Subject: [GENERAL] Question on a select Hi all, This is my first post here so please let me know if I miss an

[GENERAL] Question on a select

2005-01-01 Thread Madison Kelly
Hi all, This is my first post here so please let me know if I miss any list guidelines. :) I was hoping to get some help, advice or pointers to an answer for a somewhat odd (to me at least) SELECT. What I am trying to do is select that values from one table where matching values do not exis