Re: [SQL] the best way to get the topest 3 record in every group
> There is a table like : > << > itemNo > supplier > purchaseDate > Price > Qty > << > Please provide an idea if I want to get the latest 3 puchase records for > each item and supplier. Thank you in advance. select * from table_name where supplier=value order by purchaseDate desc limit 3 ??? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] sql group by statement
see the yesterday's thread about DISTINCT ON (non-standard Postgres feature) > I have a problem, which I'm not able to solve with a simple query : > > I need a resultset with distinct id's, but the max val2 of each id. > I tried to group by id, but though I need the pk in my resultset > I have to group it too, which "destroys" the group of val2. ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] Stripping white-space in SELECT statments
> If I want to search for records where the first column (artnrgrpmtrln_1) > begins with > '201901 ', our system that uses the database creates the following SQL > statement: > > select artnrgrpmtrln_1 from sr where (artnrgrpmtrln_1>='201901 ' and > artnrgrpmtrln_1<='201901 ΓΏ' what does "our system" mean? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Preventing DELETEs
> I have a created a database and a table in it, > > I want to prevent "DELETES" on the table in this > database by everyone except superuser postgres. > even by me (the creator of this database and table) make superuser the database owner & grant the rights needed to the users ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] alter user does not changes password
> alter user camara with password 'canabis!'; > > but when I try to connect: > > $ psql -U camara dbcamara; > > User "camara" logs with no password If I use -W option of psql > It prompts for password and I can enter whatever I want... it accepts! > > It must be a feature.. not a bug... I know I'm making a mistake.. > but.. where?? can you quote pg_hba.conf (without comments naturally) here? ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] Different size in the DATA directory
Hi, in my production server a "du -hs" in the DATA directory returns 21GB in a newly installed server, after I restored the dumps from the production server, the "du -hs" gives me just 8GB why is there such a diference??? what should I do (besides buying bigger and bigger HDs) ??? VACUUM? ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] small problem
create table (...) (...) duration interval default 7 do you really think it's worth spending 12 bytes for your intervals? i usually use either timestamps or integers for intervals. btw, as i know default 7 would be 7 msecs :) hourDaytimestamp with time zome consider using it without a time zone maybe. if you really mean time of a day use time [with time zone] (...) if i replace this two data types with varchar2(50) it works but i would like if there's a better choice it seems oracle still has some probs with sql date/time data types... ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Effective usage without unique key -- suggestion
Bhuvan A wrote: > Hi, > > I am using postgresql 7.2.1 on redhat linux 7.3 > > I have a table in very high production database which is circulating > several thousands of records per day ie.. count does not exceed several > thousands. Here for some technical reason i dont have unique key on this > table, but it should contain unique records. I know that without using > unique index it can be achieved in any of the following methods. > > Method 1 > > * check for the record. > * if exists update, else insert > > Method 2 > > * delete the record (trigger on before insert) > * insert the record > > So Can you please suggest the best among the above 2 methods? > > BTW, internals of the above 2 methods would be different. For example in > method 2, frequent deletion of records calls for vacuuming the database. > FYI, i does VACUUM ANALYZE every day. So Can you please suggest the best > among the above 2 methods which well suits me and to use postgres more > effectively? > Not really - internally update does pretty much the same thing as delete+insert - so, either way, you won't be able to get away from vacuum'ing it... I *think* the second method should be (a little) more effective... I hope, it helps... Dima ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]