Re: [SQL] query speed joining tables

2003-01-16 Thread Josh Berkus
Vernon, > The other way to build a query string is used on selection operation for multiple table joined and/or involved. A query > string is built dynmically due to whether or not any fields are examined. The characteristic of the application is that > among of many fields a user may only wa

Re: [SQL] query speed joining tables

2003-01-16 Thread Vernon Wu
16/01/2003 9:46:30 AM, "Josh Berkus" <[EMAIL PROTECTED]> wrote: >Vernon, > >> What I stated is my observation on my project with over twenty >> multivalued detail tables. I have a selection query >> contained 200 characters, involving 10 tables, and using subquery. >> The performance is not bad a

Re: [SQL] query speed joining tables

2003-01-16 Thread Josh Berkus
Vernon, > What I stated is my observation on my project with over twenty > multivalued detail tables. I have a selection query > contained 200 characters, involving 10 tables, and using subquery. > The performance is not bad after properly indexing, > least than 3 second (what the planner says).

Re: [SQL] query speed joining tables

2003-01-15 Thread Josh Berkus
Vernon, > What I stated is my observation on my project with over twenty multivalued detail tables. I have a selection query > contained 200 characters, involving 10 tables, and using subquery. The performance is not bad after properly indexing, > least than 3 second (what the planner says).

Re: [SQL] query speed joining tables

2003-01-15 Thread Vernon Wu
Hi, Josh, I appreciate you share your experience here. I definitely don't have that many years' DBA experience behind, and are learning to get DB design right at the first place. What I stated is my observation on my project with over twenty multivalued detail tables. I have a selection quer

Re: [SQL] query speed joining tables

2003-01-15 Thread Josh Berkus
Vernon,   > In regarding of recomposing multivalued field as a separated table, I > have observed some advantages and > disadvantages of the approach. Good on search as you have pointed out > and bad on updating data, two operations > needed: deletion and insertion. A query may need to join a

Re: [SQL] query speed joining tables

2003-01-13 Thread Tomasz Myrta
Christopher Smith wrote: >my mistakes, zips_max should be zips_300. >and >in my zip code table there are 120 million rows, example of the records >are > >origin destination >=== > >90210 90222 >90210 90234 >90210 96753 1.try to create inde

Re: [SQL] query speed joining tables

2003-01-13 Thread Christopher Smith
my mistakes, zips_max should be zips_300.  Tomasz Myrta <[EMAIL PROTECTED]> wrote: Christopher Smith wrote:> I have 4 tables that I need to query... 3 of the tables are links by the> field userid.>> below are table sql fragments. as well as the query. The subquery> causes very high>> CPU usages. It

Re: [SQL] query speed joining tables

2003-01-13 Thread Tomasz Myrta
Christopher Smith wrote: I have 4 tables that I need to query... 3 of the tables are links by the field userid. below are table sql fragments. as well as the query. The subquery causes very high CPU usages. It typically returns ~3000 matches. Is there another way to rewrite this? SELECT user

Re: [SQL] query speed joining tables

2003-01-13 Thread Christopher Smith
I understand cachable functions but your proposed application is a little unclear. is it possible to see an example? thanks in advance.  Josh Berkus <[EMAIL PROTECTED]> wrote: Chris,Here are probably your two main query problems:> strpos(user_match_details.ethnicity,'Asian') !=0 ANDIt is impossible

Re: [SQL] query speed joining tables

2003-01-13 Thread Josh Berkus
Chris, Here are probably your two main query problems: > strpos(user_match_details.ethnicity,'Asian') !=0 AND It is impossible for Postgres to use an index for the above as it is written. I would suggest one of two improvements; 1) Modify the schema so that multiple ethnicity details are kept