On Thu, 20 Sep 2001, David M. Richter wrote:
> Hi!
>
> Thanks, to You!
>
> Yes I have to do . Now I solved that problem with rename the original
> table study to _study
> then create the new right structured table study , Insert into study
> (chilioid,...,...) SELECT * FROM _study;
> Ok not el
On Thu, 20 Sep 2001, Patrik Kudo wrote:
> On Thu, 20 Sep 2001, Haller Christoph wrote:
>
> > Try
> > create NEWtable (userid text, val integer, ts timestamp);
> > insert into NEWtable
> > select userid, val, max(ts) from table group by userid, val;
>
> That won't work. That will give me multipl
"David M. Richter" wrote:
>
snip...
> Yes I have to do . Now I solved that problem with rename the original
> table study to _study
> then create the new right structured table study , Insert into study
> (chilioid,...,...) SELECT * FROM _study;
> Ok not elegant but it works.
>
> Another questio
Patrik Kudo <[EMAIL PROTECTED]> writes:
> create table (userid text, val integer, ts timestamp);
> This table holds multiple values for users, timestamped for history
> reasons.
>
> Now I need to fetch the latest val for each userid to insert into a new
> table (with about the same schema, except
what about using 'distinct' in you select statement?
- Original Message -
From: "Haller Christoph" <[EMAIL PROTECTED]>
To: "Patrik Kudo" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, September 20, 2001 11:02 AM
Subject: Re: [SQL] Selecting latest value II
> What do you mea
Well, this was just a suggestion to make my queries run fast. I didn't
quite understand the difference between the two, so I thought I'd ask.
Thanx for clearing that up for me.
Mike Diehl,
Network Monitoring Tool Devl.
Sandia National Laboratories.
(505) 284-3137
[EMAIL PROTECTED]
> -Origi
Look at his table structure, you will see a timestamp. His request can
be rephrased as "The val field from the latest record for each userid in
turn.
Carl van Tast had 2 good methods as follows
SELECT userid, val
FROM tbl
WHERE NOT EXISTS (SELECT * FROM tbl AS t2
WHERE tbl.us
Um no, I just need a smaller problem to solve. The database worked quite
well when the problem was half this size. Additionally, I'm processing
back-logged data right now. I've also recently redesigned the database
schema to take advantage of inheritance. This has enabled me to write
larger qu
"Diehl, Jeffrey" <[EMAIL PROTECTED]> writes:
> Ok, can someone explain to me why this first query might run faster than the
> second?
> select src,dst,count(dst) from data;
> select src,dst,count(*) from data;
Hmm, I'd expect the second to be marginally faster. count(*) counts the
number of rows
My understanding is, if you have system calls from within
postgres, the child processes invoked are run in the
postgres user's environment.
So, login as user postgres and have a look what aliases
are set. My idea is, because postgres is not a human user,
these aliases are not set. I think, if
hey all
I have created a function that is used in a trigger.
--
--
CREATE TRIGGER tr_insert_on_a AFTER INSERT OR UPDATE
ON A
FOR EACH ROW EXECUTE PROCEDURE fn_insert_on_a();
--
Try
create NEWtable (userid text, val integer, ts timestamp);
insert into NEWtable
select userid, val, max(ts) from table group by userid, val;
Regards, Christoph
>
> Hi,
>
> I have a table which basically looks like this:
>
> create table (userid text, val integer, ts timestamp);
>
> Thi
Diehl,
> Um no, I just need a smaller problem to solve. The database worked
> quite
> well when the problem was half this size.
> could do with 60 day's...!" And they are right, if it can be done...
> If it
> can't, I'll tell them and they will understand.
What I'm saying is, based on your d
Hello!
I want to restructure a table called study.
this table has the following structure:
Table "study"
Attribute| Type | Modifier
++--
chilioid | character varying(80)
Mohammad Faisal <[EMAIL PROTECTED]> said:
> hey all
>
>
> I have created a function that is used in a trigger.
>
> --
> --
>
> CREATE TRIGGER tr_insert_on_a AFTER INSERT OR UPDATE
> ON A
> FOR EAC
Hi!
Do you REALLY need to restructure your data for
changing columns?
Probably you could use views instead.
Üdv,
Baldvin
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
On Thu, 20 Sep 2001, Haller Christoph wrote:
> Try
> create NEWtable (userid text, val integer, ts timestamp);
> insert into NEWtable
> select userid, val, max(ts) from table group by userid, val;
That won't work. That will give me multiple userid-val combinations. Sure,
the userid-val combinati
Hi!
Thanks, to You!
Yes I have to do . Now I solved that problem with rename the original
table study to _study
then create the new right structured table study , Insert into study
(chilioid,...,...) SELECT * FROM _study;
Ok not elegant but it works.
Another questions:
Can I change the physic
What do you mean by
"the latest val for each userid"
I cannot understand how a value of type integer
can have a attribute like "latest".
Sorry, but I need at least a bit more information.
Regards, Christoph
>
> On Thu, 20 Sep 2001, Haller Christoph wrote:
>
> > Try
> > create NEWtable (use
I hear you. I'm just not having a good day today. My biggest problem is my
project/time ration is way too high.
I agree with you, though. If I can get it to work on 150Gb, I can probably
get it to work on 355Gb. I just may have to change the manner in which I
perform these queries.
Mike Dieh
On Thu, 20 Sep 2001, Tom Lane wrote:
> This is what SELECT DISTINCT ON was invented for. I don't know any
> comparably easy way to do it in standard SQL, but with DISTINCT ON
> it's not hard:
>
> SELECT DISTINCT ON (userid) userid, val, ts FROM table
> ORDER BY userid, ts DESC;
>
> See the DIST
21 matches
Mail list logo