Re: [SQL] Partition tables to improve select speed?

2013-01-31 Thread Jonathan S. Katz
On Jan 31, 2013, at 4:43 AM, Bert wrote: > Hello, > > We are using postgres as a datawarehouse. > We typically use very complex queries, and they seem to work very well. > > We have several BIG tables. we chose to partition those tables on a specific > key. > > We also adapted our selects,

Re: [SQL] Split a string to rows?

2013-01-07 Thread Jonathan S. Katz
On Jan 7, 2013, at 2:44 PM, Emi Lu wrote: > Hello, > > Is there a function to split a string to different rows? > > For example, t1(id, col1) > values(1, 'a, b, c'); > > select id, string_split_to_row(col1, ','); > > Return: > = > 1, a > 1, b > 1, c You can probably use some combinat

Re: [SQL] Joining several rows into only one

2012-11-28 Thread Jonathan S. Katz
On Nov 28, 2012, at 1:33 PM, JORGE MALDONADO wrote: > I have a SELECT statement that gives me a result like this: > > SONG ARTIST > --- > Song1 Artist1 > Song1 Artist2 > Song1 Artist3 > Song2 Artist2 > Song3 Artist4 > Song4 Artist1

Re: [SQL] can this be done with a check expression?

2012-08-03 Thread Jonathan S. Katz
On Aug 2, 2012, at 7:10 PM, Wayne Cuddy wrote: > I have a table with 3 columns: > > name text > start_id integer > end_id integer > > start_id and end_id are ranges which must not overlap but can have gaps > between them. Is it possible to formulate a table check constraint that > can verify tha

Re: [SQL] Inherited table identification possible

2012-05-24 Thread Jonathan S. Katz
On May 24, 2012, at 2:01 PM, George Woodring wrote: > Is it possible to identify which inherited table data came from in a query? > We have a table that has 3 inherited tables attached to it. I am looking for > a way to identify the source of the data. > > My only thought would be to add a

Re: [SQL] Can I read the data without commit

2012-03-23 Thread Jonathan S. Katz
On Mar 23, 2012, at 5:33 PM, John Fabiani wrote: > I start a transaction. > Begin > > Then I insert a lot of data - let's say two hundred rows. > > Now I need to read the same data (so the user can review). > > If the user thinks all is right then > commit. > > Can I read the data I just inse

Re: [SQL] intervals

2011-11-03 Thread Jonathan S. Katz
Hi Edward, "LIMIT" is a keyword, which is where you are getting your errors. Did you try a different variable name? Best, Jonathan On Nov 3, 2011, at 1:29 PM, Edward W. Rouse wrote: > I am writing a procedure and am having a little difficulty with an interval. > In the DECLARE section I have