Re: [SQL] designer tool connect to PostgreSQL

2004-03-08 Thread BenLaKnet
Rekall ...     http://www.totalrekall.co.uk/         (commercial website)     http://www.rekallrevealed.org/      (free sources) for designing different RDBMS like mysql, postgresl, oracle and other ... free with sources ... but packages for windows or linux are not free. Ben Yasir Malik

Re: [SQL] Help to simplify sample query

2004-03-08 Thread Tomasz Myrta
Dnia 2004-03-09 06:41, Użytkownik Daniel Henrique Alves Lima napisał: Hi guys, i have a new question about how to simplify a query. I have the tables area_course(cd_area,cd_course) and teacher_course(cd_teacher,cd_course) and a set of pairs of values {(1,2),(98,45),(11,0),...}. Now, i mus

[SQL] Help to simplify sample query

2004-03-08 Thread Daniel Henrique Alves Lima
Hi guys, i have a new question about how to simplify a query. I have the tables area_course(cd_area,cd_course) and teacher_course(cd_teacher,cd_course) and a set of pairs of values {(1,2),(98,45),(11,0),...}. Now, i must to select the areas which courses appears in teacher_course and mat

Re: [SQL] Simple SQL question

2004-03-08 Thread Iain
Sorry, did I write "ANALYSE SELECT "? It's supposed to be "EXPLAIN [ANALYSE] [VERBOSE] SELECT ..." - Original Message - From: "Daniel Henrique Alves Lima" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 1:21 PM Subject: Re: [SQL] Simple SQL question > Tha

Re: [SQL] Simple SQL question

2004-03-08 Thread Iain
Just a note based on my experience, if you are going to to use IN processing then there is a good chance that the index isn't going to be used. In some recent tests I did, the index stopped being used after I put 3 or more items in the IN list. You should build some representatve examples of the se

Re: [SQL] ANALYZE error

2004-03-08 Thread Iain
>>The only other job that could be running is a vacuum I run at 1am but I don't think it would take an hour to run. Famous last words... :-) It should be easy to check this, but I don't know if that is a likely source of problems anyway. If I were you I'd just do VACUUM ANALYSE in one comand. It

Re: [SQL] ANALYZE error

2004-03-08 Thread Tom Lane
"David Witham" <[EMAIL PROTECTED]> writes: > Occasionally I get this error message from the analyze job: > ERROR: simple_heap_update: tuple concurrently updated > What does this mean and should I do anything about it? You can get this if two ANALYZEs run in parallel for the same table; whichever

[SQL] ANALYZE error

2004-03-08 Thread David Witham
Hi all, I run a cron job at 2am every night to do an ANALYZE on my whole database: su - postgres -c 'echo analyze | /usr/bin/psql buns | grep -v ANALYZE' Its a batch oriented database so there is no user activity on it at this time. The only other job that could be running is a vacuum I run at

Re: [SQL] Simple SQL question

2004-03-08 Thread Daniel Henrique Alves Lima
Thank you, Jeremy. I've built a function that returns a string from (cd_teacher, cd_course) and i've create a functional index over this function, like : create index teacher_course_idx on teacher_course (build_unique_2p(cd_teacher,cd_course)); select * from teacher_course where build_unique_2p

Re: [SQL] Trying to make efficient "all vendors who can provide all items"

2004-03-08 Thread Christopher Browne
Clinging to sanity, [EMAIL PROTECTED] mumbled into her beard: > My mind is drawing a blank. Please consider: > TABLE 1: items: list of items in catalog > item_id | item_description > > TABLE 2: vendors: list of vendors who provide 1 or more items > vendor_id | vendor_name > > TABLE 3: item_vend

Re: [SQL] Trying to make efficient "all vendors who can provide all items"

2004-03-08 Thread terry
That's pretty nifty code. It certainly looks nicer, and looks like it would work providing vendor_id&item_id is the pk of item_vendors (and it is). I will let you know if it runs any faster... Thanks Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes

Re: [SQL] Trying to make efficient "all vendors who can provide all items"

2004-03-08 Thread Matt Chatterley
Hmm. My PGSQL knowledge is rusty, so this may be slightly microsoftified.. How about just: SELECT V.VendorID, V.VendorName, COUNT(IV.ItemID) FROM Vendor V INNER JOIN Item_Vendor IV ON IV.VendorID = V.VendorID AND IV.ItemID IN (1, 2, 3, 4, 5) GROUP BY V.VendorID, V.VendorName HAVING COUNT(IV.ItemI

Re: [SQL] Trying to make efficient "all vendors who can provide all items"

2004-03-08 Thread terry
Thanks for your response. If I understand your proposal, it is a way of getting vendors who can provide me with all the items in the items table. But the situation I have is items table could have 100k items, and I want all vendors who can provide a specific list of say 20 items. Do I misunderst

Re: [SQL] Functional index and string concatenation

2004-03-08 Thread Richard Huxton
On Monday 08 March 2004 16:02, Daniel Henrique Alves Lima wrote: > Yes, i was searching for the name of equivalent function to "||" > operator... > > Now, i've got a new problem: I need to concat three values (two > column values and a sepator constant). But from documentation: " The > func

[SQL] Trying to make efficient "all vendors who can provide all items"

2004-03-08 Thread terry
My mind is drawing a blank. Please consider: TABLE 1: items: list of items in catalog item_id | item_description TABLE 2: vendors: list of vendors who provide 1 or more items vendor_id | vendor_name TABLE 3: item_vendors: record existence indicates vendor can provide item item_id | vendor_i

Re: [SQL] Functional index and string concatenation

2004-03-08 Thread Tom Lane
Edmund Bacon <[EMAIL PROTECTED]> writes: > On Mon, 2004-03-08 at 08:19, Daniel Henrique Alves Lima wrote: >> Is there a way to create a "functional index" over a string >> concatenation of two columns ? > test=# create index str_idx on strtable( textcat(str1, str2) ); As of 7.4 you can do it mor

Re: [SQL] Functional index and string concatenation

2004-03-08 Thread Edmund Bacon
On Mon, 2004-03-08 at 08:19, Daniel Henrique Alves Lima wrote: > Is there a way to create a "functional index" over a string > concatenation of two columns ? > > Thanks. > Like this? test=# create table strtable (x int, str1 text, str2 text); CREATE TABLE test=# create index str_idx on

[SQL] Functional index and string concatenation

2004-03-08 Thread Daniel Henrique Alves Lima
Is there a way to create a "functional index" over a string concatenation of two columns ? Thanks. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] Simple SQL question

2004-03-08 Thread Daniel Henrique Alves Lima
Hello, everybody. I've a simple question about SQL usage but i don't know even i can formulate this question. Well, i will try : I've a teacher_course table with columns cd_course, cd_teacher => teacher_course(cd_teacher,cd_course) and i've a set of pairs that contains the values for t

Re: [SQL] Login information in system tables

2004-03-08 Thread Radu-Adrian Popescu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Daniel Doorduin wrote: | Hi, | | I was wondering if it is possible to query the sytem tables to get | an overview of user logins in psql. Check out the pg_user table. Regards, - -- Radu-Adrian Popescu CSA, DBA, Developer Aldratech Ltd. +40213212243 --

[SQL] Login information in system tables

2004-03-08 Thread Daniel Doorduin
Hi, I was wondering if it is possible to query the sytem tables to get an overview of user logins in psql. I've searched the documentation but I can't find a system table that stores login information, but I might have overlooked something... With regards, Daniel Doorduin -