Re: [SQL] not really SQL but I need info on BLOBs
I suggest to store the images on the disc and write in the db only the path. I am using the same solution. The only problem is that I have to make the backups separately(in my case). Also this helps more in accessing the images, you don't have to access for each image the database, you just have to get the file path. Think also at the dump size of the database (with blobs). (if you have 100GB of photos..the dump will be also that big) I never tied to put the database on 2 disks, I read somewhere that is possible but I never tried it. In my situation I don't need this, because the size of the DB is not quite that big. But for the photos we will use more discs (we are not using 2 yet) and there is no difference in this case how many discs you use, because in the DB you store only the path. I see it this way more simple, maybe other have other opinions. Best regards, Andy. - Original Message - From: "Theodore Petrosky" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, May 05, 2004 6:10 PM Subject: [SQL] not really SQL but I need info on BLOBs > Hi, > > I am starting a new project where I need to store a > lot of tiff images. So the question beckons... which > is better (not correct)? > store a blob in the database and let the db manage the > data or > store the image in a directory and store the path to > the data in the db. > > What are your opinions? Is one method better than the > other or are there simply different trade offs? > > If I store the tiff on the computer and only store the > path in the database it would be easier to add more > disk space to the computer without any changes to the > db. Also, there would be 'virtually' unlimited storage > space (only limited by the OS) > > However, it looks like it would be easier to create a > connection to the database to access the blobs. > > I would love to hear not just what others have done > but why they did it? > > Thanks for listening... > > BTW, I really like the zeroconf (rendezvous) support > in postgresql. > > Ted > > > > > __ > Do you Yahoo!? > Win a $20,000 Career Makeover at Yahoo! HotJobs > http://hotjobs.sweepstakes.yahoo.com/careermakeover > > ---(end of broadcast)--- > TIP 8: explain analyze is your friend > ---(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
[SQL] Test - please ignore
Please ignore - testing a previously misconfigured email client -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] Rank
Hey, Muhyiddin A.M Hayat sagte: > > Dear All, > > I Have below table > > id | site_name | point > +---+--- > 1 | Site A|40 > 2 | Site B|90 > 3 | Site D|22 > 4 | Site X|98 > > Would like to calc that Rank for each site, and look like > > > > id | site_name | point | rank > +---+---+-- > 1 | Site A|40 |3 > 2 | Site B|90 |2 > 3 | Site D|22 |4 > 4 | Site X|98 |1 > > What can I do to get result like that create temporary sequence ranking; select *,nextval('ranking') as rank from yourTable order by site_name asc; Greetins, Martin Knipper -- Martin Knipper [EMAIL PROTECTED] http://www.mk-os.de ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [SQL] Check a value in array
select * from table where date in ('02/02/2004', '02/03/2004' ) i'm using pgsql 7.3.2 and it works fine. Andy. - Original Message - From: "Marco Lazzeri" <[EMAIL PROTECTED]> To: "Rod Taylor" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, April 30, 2004 11:18 AM Subject: Re: [SQL] Check a value in array > Il gio, 2004-04-29 alle 19:56, Rod Taylor ha scritto: > > On Thu, 2004-04-29 at 13:37, Marco Lazzeri wrote: > > > Hi all. > > > > > > I have to check if a value is in an array. > > > > > > I've got a date array in a table and I would like to perform queries > > > like: > > > > > > SELECT * FROM table WHERE date IN dates_array; > > > > If you're using 7.4 or later, try: > > > > SELECT * FROM table WHERE date = ANY(dates_array); > > > > This will work without the contrib package. > > Thank you Rod, I forgot to specify I'm using PostgreSQL 7.3.5. > > > ---(end of broadcast)--- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
[SQL] COUNT on a DISTINCT query
Hello everybody, I’m a newbie to PostgreSQL. I have the following query: SELECT DISTINCT (at.*) FROM AGRUPACION_TERRITORIAL at, LINK_AGRUP_TE_MUNICIPIO link, MUNICIPIO m, PROVINCIA p, CCAA c WHERE at.agru_id_agrupacion_t = link.agmu_id_agrupacion_t AND link.agmu_id_municipio = m.muni_id_municipio AND c.ccaa_id_ccaa = p.prov_id_ccaa AND p.prov_id_provincia = m.muni_id_provincia AND ( ( (to_char(c.ccaa_id_ccaa, 'FM') = '7') AND ( ( (to_char(p.prov_id_provincia, 'FM') = '2') AND ( (to_char(m.muni_id_municipio, 'FM') = '') OR ('' = '') ) ) OR ('2' = '') ) ) OR ('7' = '') ) AND ( (upper(at.agru_ds_agrupacion) LIKE upper('%%')) OR ('' = '') ) ORDER BY agru_ds_agrupacion … which already works. I wanted to implement the equivalent COUNT statement. Tried this: SELECT COUNT (DISTINCT (at.*)) FROM AGRUPACION_TERRITORIAL at, LINK_AGRUP_TE_MUNICIPIO link, MUNICIPIO m, PROVINCIA p, CCAA c WHERE at.agru_id_agrupacion_t = link.agmu_id_agrupacion_t AND link.agmu_id_municipio = m.muni_id_municipio AND c.ccaa_id_ccaa = p.prov_id_ccaa AND p.prov_id_provincia = m.muni_id_provincia AND ( ( (to_char(c.ccaa_id_ccaa, 'FM') = '7') AND ( ( (to_char(p.prov_id_provincia, 'FM') = '2') AND ( (to_char(m.muni_id_municipio, 'FM') = '') OR ('' = '') ) ) OR ('2' = '') ) ) OR ('7' = '') ) AND ( (upper(at.agru_ds_agrupacion) LIKE upper('%%')) OR ('' = '') ) ORDER BY agru_ds_agrupacion … which I believe would work in other DBMS like Oracle, but won’t work in PostgreSQL. I even tried it with a nested statement, like this: SELECT COUNT(xxx.*) FROM () xxx That didn’t work either. I’d REALLY appreciate some help with this. Regards, Freddy.
[SQL] not really SQL but I need info on BLOBs
Hi, I am starting a new project where I need to store a lot of tiff images. So the question beckons... which is better (not correct)? store a blob in the database and let the db manage the data or store the image in a directory and store the path to the data in the db. What are your opinions? Is one method better than the other or are there simply different trade offs? If I store the tiff on the computer and only store the path in the database it would be easier to add more disk space to the computer without any changes to the db. Also, there would be 'virtually' unlimited storage space (only limited by the OS) However, it looks like it would be easier to create a connection to the database to access the blobs. I would love to hear not just what others have done but why they did it? Thanks for listening... BTW, I really like the zeroconf (rendezvous) support in postgresql. Ted __ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover ---(end of broadcast)--- TIP 8: explain analyze is your friend
[SQL] Procedure failing after upgrade
All, I just upgraded to the latest version from 7.2.x and now a procedure is failing. Please tell me what I'm doing wrong! Original Func: SELECT generateinvoice('{123,124}'); CREATE FUNCTION "generateinvoice" (integer[]) RETURNS integer AS ' DECLARE id_array ALIAS for $1; temppk INT4; count_it INT; BEGIN count_it := 1; SELECT INTO temppk nextval(''t_invoice_invoice_id_seq''); INSERT INTO t_invoice (invoice_id, created_date, invoice_status_id, modified_date) VALUES (temppk, CURRENT_TIMESTAMP(2), ''1'', CURRENT_TIMESTAMP(2)); WHILE id_array[count_it] LOOP UPDATE t_event SET invoice_id=temppk, event_status_id=''5'' WHERE event_id=id_array[count_it]; count_it := count_it + 1; END LOOP; -- TEST COUNT RETURN (count_it - 1); RETURN temppk; END;' LANGUAGE 'plpgsql'; My Latest Attempt: SELECT generateinvoice('{123,124}'); CREATE FUNCTION "generateinvoice" (anyarray) RETURNS integer AS ' DECLARE id_array ALIAS for $1; temppk INT4; count_it INT; BEGIN count_it := 1; SELECT INTO temppk nextval(''t_invoice_invoice_id_seq''); INSERT INTO t_invoice (invoice_id, created_date, invoice_status_id, modified_date) VALUES (temppk, CURRENT_TIMESTAMP(2), ''1'', CURRENT_TIMESTAMP(2)); WHILE id_array[count_it] LOOP UPDATE t_project SET invoice_id=temppk, project_status_id=''5'' WHERE project_id=id_array[count_it]; count_it := count_it + 1; END LOOP; RETURN temppk; END; ' LANGUAGE 'plpgsql'; ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] Procedure failing after upgrade
On Tue, 2004-05-04 at 09:32, patkins wrote: > All, > > I just upgraded to the latest version from 7.2.x and now a procedure is failing. > > Please tell me what I'm doing wrong! Please include the actual error message produced. That said, I'm getting an interesting error. It appears as if the integer array type is being confused for a boolean. WHILE id_array[count_it] LOOP It is expecting WHILE LOOP. Make the id_array[count_it] expression into a boolean rather than an integer. Something like: WHILE id_array[count_it] IS NOT NULL LOOP ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [SQL] Procedure failing after upgrade
Rod Taylor <[EMAIL PROTECTED]> writes: > an interesting error. It appears as if the integer array type is being > confused for a boolean. Up till 7.4, plpgsql's control statements didn't actually check whether the given expression returned boolean :-(. They just assumed that the resulting Datum should be interpreted as a bool. 7.4 will coerce to bool or throw an error if it can't. regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] Procedure failing after upgrade
Are you using 7.4.x now? If so, I think the problem is condition: WHILE id_array[count_it] LOOP Change it to: WHILE id_array[count_it] NOTNULL LOOP Jie Liang -Original Message- From: patkins [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 04, 2004 6:32 AM To: [EMAIL PROTECTED] Subject: [SQL] Procedure failing after upgrade All, I just upgraded to the latest version from 7.2.x and now a procedure is failing. Please tell me what I'm doing wrong! Original Func: SELECT generateinvoice('{123,124}'); CREATE FUNCTION "generateinvoice" (integer[]) RETURNS integer AS ' DECLARE id_array ALIAS for $1; temppk INT4; count_it INT; BEGIN count_it := 1; SELECT INTO temppk nextval(''t_invoice_invoice_id_seq''); INSERT INTO t_invoice (invoice_id, created_date, invoice_status_id, modified_date) VALUES (temppk, CURRENT_TIMESTAMP(2), ''1'', CURRENT_TIMESTAMP(2)); WHILE id_array[count_it] LOOP UPDATE t_event SET invoice_id=temppk, event_status_id=''5'' WHERE event_id=id_array[count_it]; count_it := count_it + 1; END LOOP; -- TEST COUNT RETURN (count_it - 1); RETURN temppk; END;' LANGUAGE 'plpgsql'; My Latest Attempt: SELECT generateinvoice('{123,124}'); CREATE FUNCTION "generateinvoice" (anyarray) RETURNS integer AS ' DECLARE id_array ALIAS for $1; temppk INT4; count_it INT; BEGIN count_it := 1; SELECT INTO temppk nextval(''t_invoice_invoice_id_seq''); INSERT INTO t_invoice (invoice_id, created_date, invoice_status_id, modified_date) VALUES (temppk, CURRENT_TIMESTAMP(2), ''1'', CURRENT_TIMESTAMP(2)); WHILE id_array[count_it] LOOP UPDATE t_project SET invoice_id=temppk, project_status_id=''5'' WHERE project_id=id_array[count_it]; count_it := count_it + 1; END LOOP; RETURN temppk; END; ' LANGUAGE 'plpgsql'; ---(end of broadcast)--- TIP 8: explain analyze is your friend ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match