From: | PV <pstm(dot)spain(at)gmail(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | static virtual columns as result? |
Date: | 2012-07-03 09:29:09 |
Message-ID: | 4FF2BB65.7080903@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hello,
I "have" this two tables:
Table Cat:
id|A|B
--+-+-
1|3|5
2|5|8
3|6|9
Table Pr:
id|Catid|
--+-
1|3
2|2
3|1
I need replace "Catid" column for corresponding values A and B (Table
Cat) in Table Pr.
Virtual table like this:
Table Pr:
id|Catid|A|B
--+-+-+
1|3|6|9
2|2|5|8
3|1|3|5
Something like this, but that works,...
SELECT * FROM pr WHERE pr.a /*> 1 AND*/*//*
<https://www.google.es/search?hl=es&sa=X&ei=ULbyT9uKGYSt0QWNy4CwCQ&ved=0CEUQvwUoAQ&q=between&spell=1>
pr.b < 10;
With subqueries is too slow:
SELECT * FROM "Pr" AS p, (SELECT "id" AS cid FROM "Cat" WHERE "lft" > 1
AND "rgt" < 10) AS c WHERE p."Cat"=c."cid" AND (...)) ORDER BY "Catid"
ASC OFFSET 0 LIMIT 40
Any suggestion?
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2012-07-03 13:44:50 | Re: static virtual columns as result? |
Previous Message | Scott Marlowe | 2012-07-01 05:00:34 | Re: MemSQL the "world's fastest database"? |