Re: [SQL] Query Performance

2009-12-08 Thread Postgre Novice
time=6909.632..6909.632 rows=3758304 loops=1) -> Seq Scan on user_subscriptions u (cost=0.00..77415.54 rows=3746154 width=49) (actual time=3.624..4265.114 rows=3758304 loops=1) Total runtime: 192585.437 ms From: "t...@fuzzy.cz" To: Pos

[SQL] Query Performance

2009-12-07 Thread Postgre Novice
Hello List, I have a query which use to run very fast now has turn into show stopper . PostgreSQL:8.2 explain analyze select user_name,A.user_id, dnd_window_start, dnd_window_stop, B.subs as subs, B.city_id as city_id, B.source_type as source_type from

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 Rodrigo E. De León Plicet <[EMAIL PROTECTED]>: > On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> wrote: >> sorry I get nothing :( > > Of course not. None of the dates you gave in the example overlap. > But it should still have the 1st entry wi

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 brian <[EMAIL PROTECTED]>: > novice wrote: >> >> 2008/11/20 Adam Rich <[EMAIL PROTECTED]>: >>> >>> select call.call_id, >>> call.datetime, >>> mobile_custodian.user_id, >>> call.mobile_no &

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 Adam Rich <[EMAIL PROTECTED]>: >> Now user Ben has passed his mobile to user Josh and we issued Josh his >> mobile on 2008-10-15. >> >> 1. Is it possible for me to write a query that will have the fields >> >> call.call_id, >> call.datetime, >> mobile_custodian.user_id, >> call.mobile_no

[SQL] date range query help

2008-11-19 Thread novice
Hi, We have two tables. select * from mobile_custodian; custodian_id | user_id | issue_date | return_date | mobile_no --+-++-+- 4 | Ben | 2008-10-11 | 2008-10-13 | 09455225998 5 |Josh | 2008-10-15 |

Re: [SQL] Results with leading zero

2008-06-15 Thread novice
Perfect! Thank you very mcuh :) 2008/6/16 A. Kretschmer <[EMAIL PROTECTED]>: > am Mon, dem 16.06.2008, um 11:48:01 +1000 mailte novice folgendes: >> I have a table >> >> CREATE TABLE problem ( >> problem_id integer, >> solution_count integer >>

[SQL] Results with leading zero

2008-06-15 Thread novice
I have a table CREATE TABLE problem ( problem_id integer, solution_count integer ); INSERT INTO problem VALUES (1001, 4); INSERT INTO problem VALUES (1012, 11); SELECT * from problem; problem_id | solution_count +--- 1001 | 4 1012 |

[SQL] count question

2008-04-08 Thread novice
i have a table CREATE TABLE meter ( meter_id integer NOT NULL, no_of_bays integer, CONSTRAINT meter_pkey PRIMARY KEY (meter_id) ) INSERT INTO meter( meter_id, no_of_bays) VALUES (5397, 2); INSERT INTO meter( meter_id, no_of_bays) VALUES (5409, 3); select

Re: [SQL] [GENERAL] work hour calculations

2007-09-08 Thread novice
On 07/09/2007, Filip Rembiałkowski <[EMAIL PROTECTED]> wrote: > 2007/9/5, Raj A <[EMAIL PROTECTED]>: > > correction: > > > > > The result I'm expecting for the above to be > > > > > >notification_time| finished_time | actual > > > +--

Re: [SQL] work hour calculations

2007-09-04 Thread novice
correction: > The result I'm expecting for the above to be > >notification_time| finished_time | actual > ++- 2007-07-06 15:50:00+10 | 2007-07-09 07:10:00+10 | 01:20:00 > 2007-07-07 12:30:00+10 | 2007-07-09 07

[SQL] work hour calculations

2007-09-04 Thread novice
Hello All, SELECT notification_time, finished_time, sum(finished_time - notification_time) as actual FROM log GROUP BY notification_time, finished_time; gives me: notification_time| finished_time | actual ++- 20

[SQL] raw data into table process

2007-08-21 Thread novice
I am trying to record the following entries into a table. I'm curious to know if there's an efficient/effective way of doing this? This entries come from an ancient datalogger (note: separated by space and uses YY/MM/DD format to record date) Plain file sample.dat 3665 OK BS 07/08/1

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread novice
Many many thanks for all the advice =) On 21/08/07, Michael Glaesemann <[EMAIL PROTECTED]> wrote: > > On Aug 20, 2007, at 19:52 , novice wrote: > > > Try 2: Here are my DDLs & DMLs > > Thanks for the data. It looks like the data you provided in the first > s

Re: [SQL] Join query help

2007-08-20 Thread novice
On 21/08/07, Michael Glaesemann <[EMAIL PROTECTED]> wrote: > Now here's where I started having trouble. I can't figure out how to > get 2 observations for week 29 (record_id 1 & 3) and 8 for week 30 > (record_id 2). Assuming the data is wrong (which is admittedly a poor > assumption), I moved ahea

Re: [SQL] [GENERAL] Join query help

2007-08-20 Thread novice
Try 2: Here are my DDLs & DMLs -- Start CREATE TABLE record ( record_id integer PRIMARY KEY, record_date timestamp with time zone NOT NULL ); INSERT INTO record(record_id, record_date) VALUES ('1', '2007-07-23 11:30:37'); INSERT INTO record(record_id, record_date) VALUES ('2', '2007-07-27 1

[SQL] Join query help

2007-08-17 Thread novice
Hi, We have the following three tables. safety=> SELECT record_id, record_date FROM record; record_id | record_date ---+ 1 | 2007-07-23 11:30:37+10 2 | 2007-07-27 11:30:14+10 3 | 2007-07-17 13:15:03+10 (3 rows) safety=> SELECT obser

Re: [SQL] populate value of column

2007-08-07 Thread novice
Thank you :-)) That's so quick! Apologies for the error on my DDL statement On 08/08/07, Phillip Smith <[EMAIL PROTECTED]> wrote: > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of novice > Sent: Wednesday, 8 August 200

[SQL] populate value of column

2007-08-07 Thread novice
I have a table CREATE TABLE meter ( meter_id integer NOT NULL, area_no integer NOT NULL, CONSTRAINT meter_pkey PRIMARY KEY (meter_id) ) ; INSERT INTO meter(meter_id, no_of_bays) VALUES (1001, 4); INSERT INTO meter(meter_id, no_of_bays) VALUES (1012, 6); select meter_id, area_no from meter;