head	1.6;
access;
symbols
	Version_2_1:1.5
	C_Demo_1:1.3;
locks; strict;
comment	@ * @;


1.6
date	91.11.09.01.50.59;	author mer;	state Exp;
branches;
next	1.5;

1.5
date	91.02.24.09.03.42;	author mao;	state Exp;
branches;
next	1.4;

1.4
date	90.09.25.16.49.30;	author kemnitz;	state Exp;
branches;
next	1.3;

1.3
date	89.09.05.17.26.17;	author mao;	state C_Demo_1;
branches;
next	1.2;

1.2
date	89.02.02.16.11.16;	author aoki;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.58.35;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.6
log
@function prototyping
@
text
@/***********************************************************************
**
**	geo-selfuncs.c
**
**	Selectivity routines registered in the operator catalog in the
**	"oprrest" and "oprjoin" attributes.
**
**	XXX These are totally bogus.
**
***********************************************************************/

#include "tmp/postgres.h"

#include "access/attnum.h"
#include "utils/geo-decls.h"

RcsId("$Header: /users/mer/postgres/src/utils/adt/RCS/geo-selfuncs.c,v 1.5 1991/02/24 09:03:42 mao Exp $");


float64 leftsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
float64 leftjoinsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
float64 contsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));
float64 contjoinsel ARGS((ObjectId opid , ObjectId relid , AttributeNumber attno , char *value , int32 flag ));

/*ARGSUSED*/
float64
areasel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 4.0;
	return(result);
}

/*ARGSUSED*/
float64
areajoinsel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 4.0;
	return(result);
}

/*
 *  Selectivity functions for rtrees.  These are bogus -- unless we know
 *  the actual key distribution in the index, we can't make a good prediction
 *  of the selectivity of these operators.
 *
 *  In general, rtrees need to search multiple subtrees in order to guarantee
 *  that all occurrences of the same key have been found.  Because of this,
 *  the heuristic selectivity functions we return are higher than they would
 *  otherwise be.
 */

/*
 *  left_sel -- How likely is a box to be strictly left of (right of, above,
 *		below) a given box?
 */

float64
leftsel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 6.0;
	return(result);
}

float64
leftjoinsel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 6.0;
	return(result);
}

/*
 *  contsel -- How likely is a box to contain (be contained by) a given box?
 */

float64
contsel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 10.0;
	return(result);
}

float64
contjoinsel(opid, relid, attno, value, flag)
	ObjectId	opid;
	ObjectId	relid;
	AttributeNumber	attno;
	char		*value;
	int32		flag;
{
	float64	result;

	result = (float64) palloc(sizeof(float64data));
	*result = 1.0 / 10.0;
	return(result);
}
@


1.5
log
@add some selectivity functions for rtrees
@
text
@d17 1
a17 1
RcsId("$Header: RCS/geo-selfuncs.c,v 1.4 90/09/25 16:49:30 kemnitz Exp Locker: mao $");
d19 5
@


1.4
log
@Updating from revision 1.3 to revision 1.5
@
text
@d17 1
a17 1
RcsId("$Header: RCS/geo-selfuncs.c,v 1.5 90/08/15 08:19:50 cimarron Exp $");
d49 80
@


1.3
log
@Working version of C-only demo
@
text
@d12 1
a12 2
#include "c.h"
#include "postgres.h"
d14 2
a15 3
#include "attnum.h"
#include "oid.h"
#include "geo-decls.h"
d17 1
a17 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/utils/adt/RCS/geo-selfuncs.c,v 1.2 89/02/02 16:11:16 aoki Stab $");
@


1.2
log
@MERGE WITH OLD TREE
@
text
@d19 1
a19 1
RcsId("$Header: geo-selfuncs.c,v 1.1 88/06/26 23:11:03 aoki Locked $");
@


1.1
log
@Initial revision
@
text
@a0 27

/*
 * 
 * POSTGRES Data Base Management System
 * 
 * Copyright (c) 1988 Regents of the University of California
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for educational, research, and non-profit purposes and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of the University of California not be used in advertising
 * or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Permission to incorporate this
 * software into commercial products can be obtained from the Campus
 * Software Office, 295 Evans Hall, University of California, Berkeley,
 * Ca., 94720 provided only that the the requestor give the University
 * of California a free licence to any derived software for educational
 * and research purposes.  The University of California makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 * 
 */



d19 1
a19 1
RcsId("$Header: geo-selfuncs.c,v 1.1 88/11/11 16:35:44 postgres Exp $");
@
