Thread: Joining on text field VS int

Joining on text field VS int

From
Radhika S
Date:
Hi,
I am going to test this out but would be good to know anyways. A large
table is joined to a tiny table (8 rows) on a text field. Should I be
joining on an int field eg: recid intead of name? Is the performance
affected in either case?
Thanks .

Re: Joining on text field VS int

From
Nikolas Everett
Date:
Joining via a tinyint or something will make your large table smaller which is nice.  Smaller tables = faster tables.

On Wed, Jan 6, 2010 at 11:21 PM, Radhika S <rs88820@gmail.com> wrote:
Hi,
I am going to test this out but would be good to know anyways. A large
table is joined to a tiny table (8 rows) on a text field. Should I be
joining on an int field eg: recid intead of name? Is the performance
affected in either case?
Thanks .

Array comparison

From
"ramasubramanian"
Date:
Hi all,
I want to compare the two arrys in sql, The below example is wrong.
But i want to know how to do that in postgres 8.2.5
 
SELECT 'x'   WHERE  string_to_array('the,quick,ram,fox', ',')  any (string_to_array('the,quick,lazy ,fox', ','))
Regards,
Ram
 

Re: Array comparison

From
Rui Carvalho
Date:
Hi

well it's pretty simple

if you want to see if there are elements in common then instead of "any" use "&&"
if you want to see if they are equal just use " = " that will five you true or false



 you can check array functions in here http://www.postgresql.org/docs/8.2/static/functions-array.html


On Fri, Jan 8, 2010 at 5:00 AM, ramasubramanian <ramasubramanian.g@renaissance-it.com> wrote:
Hi all,
I want to compare the two arrys in sql, The below example is wrong.
But i want to know how to do that in postgres 8.2.5
 
SELECT 'x'   WHERE  string_to_array('the,quick,ram,fox', ',')  any (string_to_array('the,quick,lazy ,fox', ','))
Regards,
Ram
 

Re: Array comparison

From
Merlin Moncure
Date:
On Fri, Jan 8, 2010 at 11:06 AM, Rui Carvalho <rui.hmcarvalho@gmail.com> wrote:
> Hi
>
> well it's pretty simple
>
> if you want to see if there are elements in common then instead of "any" use
> "&&"
> if you want to see if they are equal just use " = " that will five you true
> or false

you also have the option of expanding the array into a set and using
standard query techniques.  w/8.4, you can use the built in
unnest()...for earlier versions you have to create it yourself
(trivially done):

http://archives.postgresql.org/pgsql-patches/2008-03/msg00308.php

merlin