[SQL] Parallel updates on multiple cores

2008-06-09 Thread Andrei
I have the following case: a simple table drop table test_data; create table test_data ( id bigserial not null primary key, content varchar(50), processed varchar(1) ); My function doing the inserts CREATE OR REPLACE FUNCTION populate_test_data(IN nr_records BIGINT, IN proc_nr BIGINT) RETURNS i

[SQL] Create trigger for auto update function

2005-07-18 Thread Andrei Bintintan
Hi to all,   I have a table: create table hoy( id serial, pass varchar(40), pass_md5 varchar(40);   Now, I want to write a trigger function that automatically updates the pass_md5 with the md5 function of the pass.   I tried this:   CREATE FUNCTION update_pass(integer) RETURNS integer AS

[SQL] Constraint on 2 column possible?

2005-01-27 Thread Andrei Bintintan
Hi,   I have a table:CREATE TABLE werke1(id SERIAL,id_hr int4 NOT NULL,id_wk int4 NOT NULL);   CREATE TABLE contact(id SERIAL,type varchar(20), );     Now id_hr and id_wk are all referencing the same table contact(id). In the contact table I have another column called type. How can I write

Re: [PERFORM] [SQL] OFFSET impact on Performance???

2005-01-26 Thread Andrei Bintintan
gards, Andy. - Original Message - From: "Greg Stark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Richard Huxton" ; "Andrei Bintintan" <[EMAIL PROTECTED]>; ; Sent: Tuesday, January 25, 2005 8:28 PM Subject: Re: [PERFORM] [SQL] OFFSET imp

Re: [PERFORM] [SQL] OFFSET impact on Performance???

2005-01-21 Thread Andrei Bintintan
DIGGING for solutions. Andy. - Original Message - From: "Ragnar Hafstað" <[EMAIL PROTECTED]> To: Cc: "Andrei Bintintan" <[EMAIL PROTECTED]>; Sent: Thursday, January 20, 2005 9:23 PM Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? On Thu, 2005-01-

Re: [SQL] OFFSET impact on Performance???

2005-01-20 Thread Andrei Bintintan
If you're using this to provide "pages" of results, could you use a cursor? What do you mean by that? Cursor? Yes I'm using this to provide "pages", but If I jump to the last pages it goes very slow. Andy. - Original Message - From: "Richard Huxt

[SQL] OFFSET impact on Performance???

2005-01-20 Thread Andrei Bintintan
Hi to all, I have the following 2 examples. Now, regarding on the offset if it is small(10) or big(>5) what is the impact on the performance of the query?? I noticed that if I return more data's(columns) or if I make more joins then the query runs even slower if the OFFSET is bigger. Ho

Re: [SQL] SQL timestamp to date cast

2005-01-20 Thread Andrei Bintintan
chael Fuhr" <[EMAIL PROTECTED]> To: "Andrei Bintintan" <[EMAIL PROTECTED]> Cc: Sent: Thursday, January 20, 2005 11:33 AM Subject: Re: [SQL] SQL timestamp to date cast On Thu, Jan 20, 2005 at 10:52:50AM +0200, Andrei Bintintan wrote: SELECT DISTINCT(nummer) FROM user_action

[SQL] SQL timestamp to date cast

2005-01-20 Thread Andrei Bintintan
Hi,   I have the following query:   SELECT DISTINCT(nummer) FROM user_action WHERE datetime::date='11/11/2004' AND id_action IN (5,6,9)   Now, datetime has the type timestamp. How can I make an index or write different this query so that it runs faster? It really takes some time sometimes.

Re: [SQL] A transaction in transaction? Possible?

2004-11-10 Thread Andrei Bintintan
EMAIL PROTECTED]>; "Theodore Petrosky" <[EMAIL PROTECTED]>; "Andrei Bintintan" <[EMAIL PROTECTED]>; "sad" <[EMAIL PROTECTED]> Sent: Wednesday, November 10, 2004 12:58 PM Subject: Re: [SQL] A transaction in transaction? Possible? > O Mich

[SQL] upper/lower for german characters

2004-11-09 Thread Andrei Bintintan
Hi to all, I have the problem that: select lower('MöBÜEL') or select upper('MöBÜEL') are not working well. I read on some forums that there is some locale setting that needs to be done here, but could not fix this. I am using the ASCII encoding.   Please advice. Thakx.Andy.

[SQL] A transaction in transaction? Possible?

2004-11-09 Thread Andrei Bintintan
Is it possible to have another transatction in a transaction??? In the following example the last ROLLBACK is totally ignored(transaction1). //connect to database$database = dbConnect($dbhost, $dbuser, $dbpass, $dbname);dbExec($database, "BEGIN"); //transaction1//*        dbExec($databa

Re: [SQL] sql

2004-10-25 Thread Andrei Bintintan
> 2)if two ore more record have the same value of the maxim value of the "ora" > to select oly one of them At this point you really have to decide which criteria you use for this deciding. I strongly suggest to use a uniqe ID for each row in the table(in your case it is important): CREATE TABLE

[SQL] How to rename a constraint/trigger??

2004-09-06 Thread Andrei Bintintan
Hi to all,   I have a database, where in the tables I have around 100 constrains (link to other tables) that don't have a name "" or they have a name like "$1" "$2". Now, I have a module which bases on the same structure, but I get some query errors from a "" constraint. I really don't know

Re: [SQL] Last insert id

2004-06-15 Thread Andrei Bintintan
"Is it safe to use "select max(table1_id) from table1" after the insert?" Yes it is safe, but ONLY if you use it inside a transaction.(BEGIN/COMMIT). BR. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of mixo Sent: Wednesday, June 09, 2004 9:24 AM To: [EM

[SQL] Reference with condition on other table column?

2004-06-03 Thread Andrei Bintintan
Hi to all,   I have the following tables: CREATE TABLE t1(id serial PRIMARY KEY,active boolean NOT NULL DEFAULT 'y',num int4 NOT NULL,);CREATE UNIQUE INDEX t1_uniqueidx ON t1(num) WHERE active; CREATE TABLE t2(id serial PRIMARY KEY,active boolean NOT NULL DEFAULT 'y',num int4 NOT NULL,);CR

[SQL] UNIQUE columnt depdening on other column???

2004-06-02 Thread Andrei Bintintan
Hi,   I have a problem.   Let's say I have the following table: CREATE TABLE rekl_element(id serial PRIMARY KEY,active boolean NOT NULL DEFAULT 'y',num int4 NOT NULL,text varchar(10)); Now I want that "num" column is "unique" but only for those columns that have active='y'. For the col

Re: [SQL] where to start with this procedure ?

2004-05-20 Thread Andrei Bintintan
Hi, Use the Offset and Limit in the SQL query. http://developer.postgresql.org/docs/postgres/queries-limit.html For example: SELECT select_list FROM table_expression WHERE condition Let's supose that this query returnes normaly 3 elements. SELECT select_list FROM table_expressi

Re: [SQL] Exceptions when 0 rows affected.

2004-05-10 Thread Andrei Bintintan
Hi Stef, Your problem depends on what interface/programming language you're using. In a Begin End transaction you will have to verify if the returned data is good for you so then you decide if you run at the end "COMMIT" or "ROLLBACK". In php (and where is compatible) I suggest this: //this is p

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-06 Thread Andrei Bintintan
But... search the forums, or hope that somedoby else answers also. Best regards, Andy. - Original Message - From: "Theodore Petrosky" <[EMAIL PROTECTED]> To: "Andrei Bintintan" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, May 06, 2004 2:46

Re: [SQL] not really SQL but I need info on BLOBs

2004-05-05 Thread Andrei Bintintan
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

Re: [SQL] Database structure

2004-05-04 Thread Andrei Bintintan
I would go for the second one. I think the size of the table is not a problem. You will have just to write the right indexes for easy joins. OBS: " For one assessment, I'll store 60 rows with only two useful integers in it" ... why? Better make a "lab_test" table where you have the tab tests and y

Re: [SQL] start

2004-05-04 Thread Andrei Bintintan
You say that you're running Suse 8. You can also start the process with that Yast. Start Yast2 -> System -> Runlevel Editor-> and then you can select the runlevel when you want that postgre starts. I start it at runlevel 3. If you installed postgre it manually you have a little work to do, probabl

[SQL] SQL query --- big question???

2004-03-12 Thread Andrei Bintintan
Hi to all,   I have a big question.   Can I write a query/function/agregate function (whatever) so that I can return the result of a query in a single line? I don't know if this is possible to be made and please if it is not possible please say.     I better give an example:   table (id, nam

[SQL] Is it possible to use lo_write in SQL?

2002-09-27 Thread Boulgakov Andrei
Hi! Is it possible to use lo_write in SQL? If so, how? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster