Page 1 of 1

How do I handle a union of multiple tables in Xataface?

PostPosted: Mon Jul 05, 2010 9:32 pm
by Jusmee
I have multiple tables, all with the same fields. mySQL/xataface just runs too slow if I put them into one big table. So how do I search across all of them at once, i.e. search a union of the tables? - or is this the wrong approach?

Re: How do I handle a union of multiple tables if Xataface?

PostPosted: Mon Jul 05, 2010 9:38 pm
by shannah
You could create a view with the union and search that.

Re: How do I handle a union of multiple tables if Xataface?

PostPosted: Mon Jul 05, 2010 10:48 pm
by Jusmee
shannah wrote:You could create a view with the union and search that.


OK, it's my lack of knowledge with xataface, but, will it list and search a view the same way as it does tables? Do you just put the view name in the ini file as if it was a table?

Re: How do I handle a union of multiple tables in Xataface?

PostPosted: Tue Jul 06, 2010 9:40 am
by shannah
Yes. You just need to tell xataface which fields are part of the primary key. You do that in the fields.ini file with the Key=PRI directive.

e.g.
Code: Select all
[my_field]
    Key=PRI

Re: How do I handle a union of multiple tables in Xataface?

PostPosted: Tue Jul 06, 2010 4:19 pm
by Jusmee
Yep that works, thanks. The only downside is that views with a UNION clause are non-updatable.