How do I handle a union of multiple tables in Xataface?
Archived from the Xataface Users forum.
Jusmee — Mon Jul 05, 2010 9:32 pm
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?
shannah — Mon Jul 05, 2010 9:38 pm
You could create a view with the union and search that.
Jusmee — Mon Jul 05, 2010 10:48 pm
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?
shannah — Tue Jul 06, 2010 9:40 am
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
Jusmee — Tue Jul 06, 2010 4:19 pm
Yep that works, thanks. The only downside is that views with a UNION clause are non-updatable.