Re: [SQL] combining strings to make a query

2011-07-13 Thread Kevin Crain
You can do full-text search in postgres now using ts_vectors. I'd recommend going that route. Doing like comparisons is not a good idea if you don't know the first part of the string you are searching forIt appears to be much faster from my experience to search for ab% than it is to search

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
I still can't imagine why you'd ever need this...could you explain what this does? I'm just curious now On Tue, Jul 12, 2011 at 10:55 PM, Kevin Crain kevin.cra...@gmail.com wrote: This is an unfortunate situation, you shouldn't be required to do this, the people generating your requirements

[SQL] newbie question * compare integer in a where IN statement

2011-07-13 Thread Jose Ig Mendez
Title: Firma Correo Hi everybody, I'm trying to compare in a sentence like this (using PostGres 8.3) : select * from myTable where id_integer IN ('1,2,3,4') I want to get the records which key "id_integer" is 1 or 2 or 3 or 4. the type od my

Re: [SQL] newbie question * compare integer in a where IN statement

2011-07-13 Thread Thomas Kellerer
Jose Ig Mendez, 13.07.2011 09:36: Hi everybody, I'm trying to compare in a sentence like this (using PostGres 8.3) : select * from myTable where id_integer IN ('1,2,3,4') I want to get the records which key id_integer is 1 or 2 or 3 or 4. the type od my id, of course, is integer. I've

Re: [SQL] newbie question * compare integer in a where IN statement

2011-07-13 Thread Pavel Stehule
Hello you can try SELECT .. FROM .. WHERE id = ANY(string_to_array('1,2,3,4,5',',')) other forms are slow Regards Pavel Stehule 2011/7/13 Jose Ig Mendez jmen...@andago.com Hi everybody, I'm trying to compare in a sentence like this (using PostGres 8.3) : select * from myTable where

Re: [SQL] newbie question * compare integer in a where IN statement

2011-07-13 Thread Jose Ig Mendez
Title: Firma Correo Hi, Thank you very much Pavel, that solves my problem Regards On 13/07/11 09:50, Pavel Stehule wrote: Hello you can try SELECT .. FROM .. WHERE id = ANY(string_to_array('1,2,3,4,5',',')) other

[SQL] Select random lines of a table using a probability distribution

2011-07-13 Thread Jira, Marcel
Hi! Let's consider I have a table like this idqualificationgenderageincome I'd like to select (for example 100) lines of this table by random, but the random mechanism has to follow a certain probability distribution. I want to use this procedure to construct a test group for

Re: [SQL] Select random lines of a table using a probability distribution

2011-07-13 Thread k...@rice.edu
On Wed, Jul 13, 2011 at 03:27:10PM +0200, Jira, Marcel wrote: Hi! Let's consider I have a table like this idqualificationgenderageincome I'd like to select (for example 100) lines of this table by random, but the random mechanism has to follow a certain probability

Re: [SQL] combining strings to make a query

2011-07-13 Thread Wes James
Thank you for the tsvectors info! -wes On Wed, Jul 13, 2011 at 12:11 AM, Kevin Crain kevin.cra...@gmail.com wrote: You can do full-text search in postgres now using ts_vectors.  I'd recommend going that route.  Doing like comparisons is not a good idea if you don't know the first part of the

Re: [SQL] Max column number.

2011-07-13 Thread Miguel Angel Conte
Hi, Thanks for your interest. This app load scv files which change every day (sometimes the columns too). The sizes of these files are in avg 15MB. So, We load something like 100MB each day. We tried to find a better solution but we couldn't, becouse one of the our requirement is not to use a lot

Re: [SQL] Max column number.

2011-07-13 Thread Reinoud van Leeuwen
On Wed, Jul 13, 2011 at 12:45:45PM -0300, Miguel Angel Conte wrote: Hi, Thanks for your interest. This app load scv files which change every day (sometimes the columns too). The sizes of these files are in avg 15MB. So, We load something like 100MB each day. We tried to find a better

[SQL] Looking for a show create table name equivalent

2011-07-13 Thread B.Rathmann
Hello, I've been trying to find out how to find out which sql was run to create a certain table. As I need this in a program which may access the database remotely, using pg_dump --schema-only or psql is not an option (the system my program runs on may not even have those tools installed).

[SQL] newbie question * compare integer in a where IN statement

2011-07-13 Thread Jose Ig Mendez
Title: Firma Correo Hi everybody, I'm trying to compare in a sentence like this (using PostGres 8.3) : select * from myTable where id_integer IN ('1,2,3,4') I want to get the records which key "id_integer" is 1 or 2 or 3 or 4. the type od my "id", of

Re: [SQL] using explain output within pgsql

2011-07-13 Thread Gavin Flower
On 11/07/11 08:18, Pavel Stehule wrote: 2011/7/10 Uwe Bartelsuwe.bart...@gmail.com: Hi Pavel, is it posible to get this running even with dynamic sql? I didn't write that. I'm using execute to run this create table probably yes postgres=# do $$ declare x text; begin execute

Re: [SQL] Max column number.

2011-07-13 Thread Scott Marlowe
On Wed, Jul 13, 2011 at 9:45 AM, Miguel Angel Conte diaf...@gmail.com wrote: Hi, Thanks for your interest. This app load scv files which change every day (sometimes the columns too). The sizes of these files are in avg 15MB. So, We load something like 100MB each day. We tried to find a better

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
How are you determining the data types for these columns? On Wed, Jul 13, 2011 at 8:45 AM, Miguel Angel Conte diaf...@gmail.com wrote: Hi, Thanks for your interest. This app load scv files which change every day (sometimes the columns too). The sizes of these files are in avg 15MB. So, We

Re: [SQL] Max column number.

2011-07-13 Thread Miguel Angel Conte
I have the metadata in the same csv. On Wed, Jul 13, 2011 at 3:00 PM, Kevin Crain kevin.cra...@gmail.com wrote: How are you determining the data types for these columns? On Wed, Jul 13, 2011 at 8:45 AM, Miguel Angel Conte diaf...@gmail.com wrote: Hi, Thanks for your interest. This app

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
Is there any room for improvement in the data types? On Wed, Jul 13, 2011 at 11:03 AM, Miguel Angel Conte diaf...@gmail.com wrote: I have the metadata in the same csv. On Wed, Jul 13, 2011 at 3:00 PM, Kevin Crain kevin.cra...@gmail.com wrote: How are you determining the data types for these

Re: [SQL] Max column number.

2011-07-13 Thread Kevin Crain
Have you tried changing the block size? http://wiki.postgresql.org/wiki/FAQ#What_is_the_maximum_size_for_a_row.2C_a_table.2C_and_a_database.3F On Wed, Jul 13, 2011 at 11:03 AM, Miguel Angel Conte diaf...@gmail.com wrote: I have the metadata in the same csv. On Wed, Jul 13, 2011 at 3:00 PM,

Re: [SQL] Looking for a show create table name equivalent

2011-07-13 Thread Guillaume Lelarge
On Tue, 2011-07-12 at 10:33 +0200, B.Rathmann wrote: [...] I've been trying to find out how to find out which sql was run to create a certain table. As I need this in a program which may access the database remotely, using pg_dump --schema-only or psql is not an option (the system my program

Re: [SQL] Looking for a show create table name equivalent

2011-07-13 Thread Wes James
On Tue, Jul 12, 2011 at 2:33 AM, B.Rathmann b.rathm...@ping.de wrote: Hello, I've been trying to find out how to find out which sql was run to create a certain table. As I need this in a program which may access the database remotely, using pg_dump --schema-only or psql is not an option

Re: [SQL] Looking for a show create table name equivalent

2011-07-13 Thread Wes James
On Tue, Jul 12, 2011 at 2:33 AM, B.Rathmann b.rathm...@ping.de wrote: Hello, I've been trying to find out how to find out which sql was run to create a certain table. As I need this in a program which may access the database remotely, using pg_dump --schema-only or psql is not an option (the