Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to use Partition in Query

Re: How to use Partition in Query

From: <roytmaned_at_yahoo.com>
Date: 10 Apr 2006 14:01:41 -0700
Message-ID: <1144702901.439347.137670@i39g2000cwa.googlegroups.com>

  1. As far as I know you can fetch from one partition

SELECT COUNT(*) FROM table PARTITION (partitionname);

2. If you need from 2 partitions you can use union SELECT COUNT(*) FROM table PARTITION (partitionname1); union all
SELECT COUNT(*) FROM table PARTITION (partitionname2);

3. Depending on your method of partitioning(range, hash, etc), if you structure your query right, the ptimizer will prune the partitions for you, ie say if your table partitioned by date and you select where dates between first and second partition data range it will prune your pratitions and will only select from 2 that it needs to query no external interraction needed........

hope it helps,
Eugene Roytman

Lucky wrote:
> Hi All,
>
> I have a table which has more than 10 partitions.Now I want to query
> the table but don't want a full table scan.I want to fetch results from
> 2 partiitions (suppose partition A and B).How can I do that.Can I use
> multiple partition name in my query.
>
> All the reply will be highly appreciated.
>
> Thanks in Advance.
Received on Mon Apr 10 2006 - 16:01:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US